Skip to content

Vue: Cannot find name T #5312

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Kamiikaze opened this issue Apr 9, 2025 · 2 comments
Closed

Vue: Cannot find name T #5312

Kamiikaze opened this issue Apr 9, 2025 · 2 comments
Labels
invalid This doesn't seem right

Comments

@Kamiikaze
Copy link

Vue - Official extension or vue-tsc version

bundled 243.26053.12

VSCode version

WebStorm 2024.3.5

Vue version

3.4.31

TypeScript version

5.6.3

System Info

System:
    OS: Windows 11 10.0.22631
    CPU: (8) x64 AMD EPYC 7543P 32-Core Processor               
    Memory: 8.73 GB / 27.98 GB
  Binaries:
    Node: 22.14.0 - C:\Program Files\nodejs\node.EXE
    npm: 11.2.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Edge: Chromium (127.0.2651.74)
    Internet Explorer: 11.0.22621.3527

package.json dependencies

"dependencies": {
    "@mdi/font": "7.4.47",
    "core-js": "3.37.1",
    "pinia": "2.1.4",
    "roboto-fontface": "*",
    "vue": "3.4.31",
    "vue3-toastify": "^0.2.8",
    "vuetify": "3.6.14"
  },
  "devDependencies": {
    "@eslint/js": "9.14.0",
    "@tsconfig/node22": "22.0.0",
    "@types/node": "22.9.0",
    "@vitejs/plugin-vue": "5.1.4",
    "@vue/eslint-config-prettier": "10.1.0",
    "@vue/eslint-config-typescript": "14.1.3",
    "@vue/tsconfig": "0.5.1",
    "eslint": "9.14.0",
    "eslint-config-prettier": "9.1.0",
    "eslint-plugin-vue": "9.30.0",
    "npm-run-all2": "7.0.1",
    "prettier": "3.4.1",
    "sass": "1.77.8",
    "sass-embedded": "1.77.8",
    "typescript": "~5.6.3",
    "unplugin-fonts": "1.1.1",
    "unplugin-vue-components": "0.27.2",
    "unplugin-vue-router": "0.10.0",
    "vite": "5.4.10",
    "vite-plugin-vuetify": "2.0.3",
    "vue-cli-plugin-pinia": "~0.2.4",
    "vue-router": "4.4.0",
    "vue-tsc": "2.1.10"
  },

Steps to reproduce

Made an interface to have my components data typed. As I dont want to type any data property I added [key: string]: T; to the type.

interface typedData {
  tableItems: CombinedTranslationItem[];
  selectedScopes: Reactive<string[]>;
  loading: { data: boolean; save: boolean };
  deleteItem: Reactive<CombinedTranslationItem>;
  headers: [] | MutableHeaders;
  defaultHeaders: MutableHeaders;
  editedValues: Reactive<editItem>;
  [key: string]: T;
}

What is expected?

Shouldn't be an error as it's a generic type

What is actually happening?

Editor shows error:
Vue: Cannot find name T

Link to minimal reproduction

No response

Any additional comments?

No response

@PindaPixel
Copy link

Where do you define T?
Either your interface needs to add is a generic parameter or if these are your props in an SFC you need to add it in the script setup attributes.

@KazariEX KazariEX added need info invalid This doesn't seem right and removed pending triage need info labels Apr 10, 2025
@KazariEX
Copy link
Member

What you may want is [key: string]: any.

@KazariEX KazariEX closed this as not planned Won't fix, can't repro, duplicate, stale Apr 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invalid This doesn't seem right
Projects
None yet
Development

No branches or pull requests

3 participants