-
Notifications
You must be signed in to change notification settings - Fork 507
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
Automatically generate runtime config types from nitro.config the same as Nuxt #1706
Comments
💎 $20 bounty created by @McPizza0 |
This is a good idea. As part of the implementation notes, I think we should enable it only by |
I would like to take a look at this. |
This would also help in nuxt when accessing runtime config from server side utils. Currently when using useRuntimeConfig in a tRPC route, nothing is typed. |
/attempt #1706 |
@rishi-raj-jain this may need input from @pi0 and @danielroe I'm not sure how it was implemented in nuxt, but I would assume the solution will be fairly similar Need to make sure it doesn't conflict with nuxt |
@pi0 @McPizza0 @danielroe @rishi-raj-jain Maybe we can use the TypeScript Compiler API to parse the configuration file and extract the types and then generate TypeScript definition files (.d.ts) based on the extracted types and apply the generated types. |
We use unjs/untyped to do inference in Nuxt. See this for reference: https://github.com/nuxt/nuxt/blob/dfdebf29191b7ef2c00873b1201bf48a206bf95e/packages/nuxt/src/core/templates.ts#L140 |
@McPizza0 is this issue still open? @rishi-raj-jain are you still attempting this? I'd like to give it a try if you're not. |
@ap172x sure go ahead. |
i'll try it |
@ap172x @rishi-raj-jain @karthiknadar1204 can I take this? /attempt #1706 |
Sure go ahead.
…On Wed, Feb 28, 2024, 19:47 Sashko ***@***.***> wrote:
@ap172x <https://github.com/ap172x> @rishi-raj-jain
<https://github.com/rishi-raj-jain> @karthiknadar1204
<https://github.com/karthiknadar1204> can I take this?
/attempt #1706 <#1706>
—
Reply to this email directly, view it on GitHub
<#1706 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ALBHXORLWSY2WRQVB3DGYH3YV44ABAVCNFSM6AAAAAA4QKCMG6VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSNRZGA3TSMBTGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Describe the feature
In Nuxt runtimeConfig keys/values are typed.
This improves DX considerably when accessing vis useRuntimeConfig()
Nitro has not yet implemented this, which can cause some confusion for users coming over from Nuxt
Result:
useRuntimeConfig() should be aware of the keys that exist in nitro.config.ts, and provide correct types
Additional information
The text was updated successfully, but these errors were encountered: