-
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
feat(schema): add type hints for runtime config #18652
Conversation
Β Open in CodeSandbox Web Editor | VS Code | VS Code Insiders |
Really nice DX π₯ |
Since env handling logic is happening in Nitro, i think we could generate types also from nitro types. BTW really nice addition π₯ |
For runtime consistency, we might also directly use scule (in build time) to generate precise types. |
Indeed, it might be nice to add a facility to generate TSDoc comments via a callback for |
This is a really great feature! Cant wait to see it in the new version of nuxt π |
merging as a first step - moving to tsdoc is definitely better performance-wise but will need to be implemented in https://github.com/unjs/untyped. |
π Linked issue
#18594 (comment)
β Type of change
π Description
This PR adds type hints (within nuxt.config only, not within
useRuntimeConfig
) to advise on the way to override runtime config:I would value some testing on this and improving the algorithm to make sure we are matching
scule
. (We might also move intoscule
itself if you like @pi0, and that way we could add more type tests there.)BTW, I initially considered using https://github.com/sindresorhus/type-fest/blob/main/source/snake-case.d.ts but there were issues with it (e.g.
baseURL
andPascalCase
both gave incorrect results) and I thought better to take a completely different approach.π Checklist