-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
58 errors when building with latest TypeScript and proposed config #3296
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
Comments
Running Sidenote: your
|
Thanks a lot for the reply and fix for tsc! For the sidenote:
|
Correction: All code except the import is taken from the docs. The docs actually does not say how to import with ESM. |
There is ongoing work to make this more visible in the guides but it is documented in the API Reference (at the top of the page): https://v3.vuejs.org/api/global-api.html For users coming from Vue 2, it is explained in the migration guide: https://v3.vuejs.org/guide/migration/global-api.html#a-new-global-api-createapp I suspect a lot of users pick it up from either Vue CLI or familiarity with this import pattern from other libraries. There are other examples where ES module usage is shown but it does need greater prominence somewhere near the start of the guide. That should be coming as part of the issue I linked above. |
You seem to have missed this: https://v3.vuejs.org/guide/typescript-support.html#defining-vue-components
In JS, you can use simple objects. To get type inference in Typescript, you need to tell TS that this random object actually represents a component, so this is necessary. It was also already necessary in Vue 2, where you use https://vuejs.org/v2/guide/typescript.html#Basic-Usage Single File Components (*.vue files) are different in that tools like Vetur can safely assume that the object in the default export is representing a .vue component - but in .ts files you always needed to tell TS what is a Vue component, and what isn't. I'll close this issue as there is no bug in Vue 3 core and docs improvements are already tracked. |
Version
3.0.5
Reproduction link
https://github.com/lillem4n/vue3typescript
Steps to reproduce
What is expected?
TypeScript should process index.ts without problem.
What is actually happening?
58 errors are reported from libraries.
The text was updated successfully, but these errors were encountered: