1

when i try something like

const d: [number, number] = [1, 2];

i get ts error: Parsing error: Cannot read properties of undefined (reading 'map')eslint

what can cause the problem?

  • added package json and tslint as required tell me if i need to add more info ty for your answer

package.json

  "devDependencies": {
    "@types/es6-promise": "^3.3.0",
    "@types/express": "^4.11.1",
    "@types/mongodb": "^3.5.27",
    "@types/node": "^12.20.6",
    "@types/socket.io": "^1.4.38",
    "@typescript-eslint/eslint-plugin": "^2.34.0",
    "@typescript-eslint/parser": "^2.34.0",
    "cpx": "^1.5.0",
    "del-cli": "^1.1.0",
    "empty-folder": "^2.0.1",
    "eslint": "^6.3.0",
    "json-schema-to-typescript": "^11.0.1",
    "nodemon": "^1.17.4",
    "npm-run": "^5.0.1",
    "rimraf": "^3.0.1",
    "tsconfig-paths": "^4.0.0",
    "typescript": "^4.2.3"
  },

my .eslintrc.js

module.exports = {
  parser: "@typescript-eslint/parser",
  plugins: ["@typescript-eslint"],
  extends: ["plugin:@typescript-eslint/recommended"],
  rules: {
    // note you must disable the base rule as it can report incorrect errors
    indent: "off",
    "@typescript-eslint/indent": ["error", 2],
    "@typescript-eslint/explicit-function-return-type": [0],
    "@typescript-eslint/no-explicit-any": [0],
    "@typescript-eslint/no-unused-vars": [0],
    "@typescript-eslint/camelcase": [0],
    "@typescript-eslint/no-namespace": [0],
    "@typescript-eslint/no-empty-interface": [
      "error",
      {
        allowSingleExtends: true
      }
    ],
    "no-multiple-empty-lines": [
      "error",
      {
        max: 1,
        maxEOF: 1,
        maxBOF: 0
      }
    ],
    "no-var": "error",
    "newline-before-return": "error",
    semi: [2],
    "padding-line-between-statements": [
      "error",
      { blankLine: "always", prev: "*", next: "if" },
      { blankLine: "always", prev: "*", next: "for" },
      { blankLine: "always", prev: "*", next: "switch" },
      { blankLine: "always", prev: "*", next: "while" },
      { blankLine: "always", prev: "*", next: "break" },
      { blankLine: "always", prev: "*", next: "try" }
    ],
    "comma-dangle": ["error", "never"]
  }
};
mr_robot
  • 415
  • 1
  • 5
  • 16

1 Answers1

2

I upgrade to

 "@typescript-eslint/eslint-plugin": "^5.26.0",
 "@typescript-eslint/parser": "^5.26.0",
 "typescript": "^4.7.2"

Ty to Black answer from Line 0: Parsing error: Cannot read property 'map' of undefined

mr_robot
  • 415
  • 1
  • 5
  • 16