The editor doesn't know the type of brIndex neither. If I remove brIndex from the :key property, then both eslint's vue/no-unused-vars (expected) and the TS6133 show up.

Example of the problem

Here's my tsconfig.json:

{
  "extends": "@vue/tsconfig/tsconfig.web.json",
  "include": ["env.d.ts", "src/**/*", "src/**/*.vue"],
  "compilerOptions": {
    "allowJs": true,
    "baseUrl": ".",
    "paths": {
      "@/*": ["./src/*"]
    }
  },

  "references": [
    {
      "path": "./tsconfig.config.json"
    }
  ]
}

tsconfig.config.json:

{
  "extends": "@vue/tsconfig/tsconfig.node.json",
  "include": [
    "vite.config.*",
    "vitest.config.*",
    "cypress.config.*",
    "playwright.config.*"
  ],
  "compilerOptions": {
    "composite": true,
    "types": ["node"],
    "allowJs": true
  }
}

package.json:

{
  "type": "module",
  "scripts": {
    // scripts...
  },
  "dependencies": {
    "vue": "^3.2.45",
    "vue-router": "^4.1.6",
  },
  "devDependencies": {
    "@rushstack/eslint-patch": "^1.1.4",
    "@types/node": "^18.11.17",
    "@vitejs/plugin-vue": "^4.0.0",
    "@vue/eslint-config-typescript": "^11.0.0",
    "@vue/tsconfig": "^0.1.3",
    "eslint": "^8.30.0",
    "eslint-plugin-vue": "^9.8.0",
    "npm-run-all": "^4.1.5",
    "typescript": "~4.7.4",
    "vite": "^4.0.0",
    "vue-tsc": "^1.0.12"
  }
}

I can provide any additional info.

I am using Volar takeover mode and have "typescript.tsdk": "node_modules/typescript/lib" in workspace's vscode settings.json. My ESLint is configured properly (doesn't differ from a new project's .eslintrc.cjs) and there are no warning from my editor in that regard.

I also have my src/vue-shim.d.ts file although I don't know why it's needed in this configuration, but there are errors without it:

declare module '*.vue' {
  import type { DefineComponent } from 'vue'
  const component: DefineComponent<{}, {}, any>
  export default component
}

And the /env.d.ts file:

/// <reference types="vite/client" />

vite.config.ts has the default resolve and alias settings that's all.

The bottom bar looks normal:

enter image description here

The project itself runs normally and without errors.

0

There are 0 best solutions below