Open some-user123 opened 2 weeks ago
Add the node_modules
folder to ignore. You should not go inside the libraries.
nuxt autogenerates .nuxt/tsconfig.json
which contains both includes and excludes. Excerpt:
"include": [
"./nuxt.d.ts",
"../.config/nuxt.*",
"../**/*",
//...
"../node_modules/.pnpm/@nuxt+ui@3.0.0-alpha.8_@babel+parser@7.26.2_change-case@5.4.4_embla-carousel@8.3.1_ioredis@5._ijev2tcjydqcdikviydmvhkbzq/node_modules/@nuxt/ui/runtime",
"../node_modules/.pnpm/@nuxt+ui@3.0.0-alpha.8_@babel+parser@7.26.2_change-case@5.4.4_embla-carousel@8.3.1_ioredis@5._ijev2tcjydqcdikviydmvhkbzq/node_modules/@nuxt/ui/dist/runtime",
"exclude": [
"../dist",
"../node_modules",
"../node_modules/.pnpm/nuxt@3.14.0_@parcel+watcher@2.5.0_@types+node@22.9.0_ioredis@5.4.1_lightningcss@1.28.1_magica_x3y46x7cew36owemzwsfja6ire/node_modules/nuxt/node_modules",
// ...
My point is, that users of nuxt and nuxt/ui shouldn't have to take care of internals of nuxt and nuxt/ui. I don't care, if the solution is a suitable autogenerated tsconfig.json
or the removal of the type errors.
Why do you use the strictTemplates
option exactly? I can't find any documentation about this. Also, the errors mentioned don't seem to be easily fixable. If we have to type aria-label
or any other html attribute on every component we'll still be there last year. Have you tried with Radix Vue only? I'm pretty sure it will do the same thing.
Since you just want to rely on the generated tsconfig.json
from nuxt, why override it?
Why do you use the
strictTemplates
option exactly?
strictTemplates
basically enables type safety for templates. So, things we are used to in Type Script are getting applied and available in the template section as well, i.e.: You cannot access unknown properties.
In script you get complaints if you're accessing invalid properties:
Property 'len' does not exist on type 'string'.
That avoids typing mistakes, helps you identify properties that aren't valid any more because the interface changed etc.
With strictTemplates
you get the same in the template as well:
Object literal may only specify known properties, and 'len' does not exist in type 'InputHTMLAttributes & ReservedProps'.
If we have to type
aria-label
or any other html attribute on every component we'll still be there last year.
As @hywax has suggested, maybe something is wrong with the config here as type errors within libraries should normally not be reported to the user.
As said in #731, it's absolutely not necessary to manually type all the html attributes. This has already been done. For your components, you should be able to merge the types so that the information gets propagated.
Have you tried with Radix Vue only?
We haven't considered Radix Vue as a choice for our ui tooling, but @nuxt/ui. Therefore evaluating @nuxt/ui among others.
Using Radix Vue doesn't cause type errors on import.
Since you just want to rely on the generated tsconfig.json from nuxt, why override it?
We want to rely on the autogenerated tsconfig.json as far as possible. As nuxt documentation suggests, the content can be customized to a certain extend. With respect to strictTemplates
the autogenerated config neither enables nor disables it. Unlike the paths.
Environment
Build Modules: -
Version
v3.0.0-alpha.8
Reproduction
https://github.com/some-user123/nuxt-ui-3-typeerrors
Description
npx nuxi typecheck
Expected: no errors
Actually: 35 errors
Additional context
No response
Logs
No response