-
-
Notifications
You must be signed in to change notification settings - Fork 30
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
fix: proper runtimeConfig
and publicRuntimeConfig
declaration
#950
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great! I wonder if we ned to do this in a separate template so we can do it conditionally on whether nitro
is enabled or not as I think the runtimeConfig has a different format if it's disabled.
Wise enough. I'll take another round of refactoring to ensure it has support for nitro-less build |
(converting to draft just for more obvious triage - feel free to mark ready any time you feel like it) |
' interface NuxtAppCompat {', | ||
' $config: RuntimeConfig', | ||
' }', | ||
' interface NuxtRuntimeConfig extends RuntimeConfig {}', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't really know about this: we can use
const { $config } = useNuxtApp()
const { nuxt2Context: { $config } } = useNuxtApp()
but displayed types will be different
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice! Looks good to me!
Beautiful work! In future we likely need to add a type test and confirm that |
π Linked issue
Resolves #948
β Type of change
π Description
This PR backports schema generation approach from https://github.com/nuxt/nuxt/blob/4b2608c74d80551eee857ab74ab470da839894f9/packages/nuxt/src/core/templates.ts#L132, which introduces next fixes/features:
$config
in Vue templates is declared with the same generated typeπ Checklist
Before:
After:
(Untyped has some struggles with array types, not Nuxt itself issue):