-
-
Notifications
You must be signed in to change notification settings - Fork 39
Cannot find name defineProps
ts error
#102
Comments
Example Project: https://github.com/antfu/unplugin-vue2-script-setup/blob/main/examples/vue-cli/src/shims-vue.d.ts |
Thanks, but that doesn't seem to work, not only it didn't solve the problem with unrecognized and with JSX syntax: Adding Also this example project is a vue-cli project and mine is vite, maybe that matters. |
|
Thank you, that was it! I have I've pushed changes to the repo, now it compiles fine, however I'll leave this issue open as I consider it to be the documentation issue. Readme says:
I'm not using Volar or VS Code so I've skipped this step, but it seems that you need to add the dependency anyway. |
@jacekkarczmarczyk vue-tsc is volar @_@ |
|
It happens to me because I didn't give it |
i. Install VS Code Extension
ii. Install Dependencies
iii. Config {
"eslintConfig": {
"globals": {
"defineProps": "readonly",
"defineEmits": "readonly",
"defineExpose": "readonly"
}
}
} iv. Config {
"compilerOptions": {
"checkJs": true,
"allowJs": true,
"baseUrl": ".",
"paths": {
"@/*": [
"src/*"
]
}
},
"exclude": [
"dist",
"node_modules",
],
"include": [
"src/**/*"
],
"typeAcquisition": {
"include": ["@vue/runtime-dom"]
},
"vueCompilerOptions": {
"experimentalCompatMode": 2
}
} v. Config Vite
|
In a vue2 + vite + unplugin-vue2-script-setup project i have a ts error (not eslint) on build that
Cannot find name defineProps/defineEmits
Here's project's tsconfig https://github.com/jacekkarczmarczyk/rachunek/blob/master/tsconfig.json and example usage of defineProps https://github.com/jacekkarczmarczyk/rachunek/blob/master/src/components/BillForm/BillForm.vue#L163 (that's not a minimal repro, but I guess just the settings files are imporant, if you want a minimal repro though let me know)
To reproduce the issue run
yarn build
Error can be supressed with
// @ts-ignore
but that doesn't sound like a valid solution. Another option is to add .d.ts files withdefineProps
declaration but I think that should be rather provided by the lib (or maybe it is but can't find anything)The text was updated successfully, but these errors were encountered: