Skip to content
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

RuntimeConfig property is unknown #1253

Closed
1 task done
maou-shonen opened this issue May 19, 2023 · 9 comments
Closed
1 task done

RuntimeConfig property is unknown #1253

maou-shonen opened this issue May 19, 2023 · 9 comments
Labels
bug Something isn't working needs reproduction

Comments

@maou-shonen
Copy link
Contributor

Describe the feature

refer unjs/h3#386
Perhaps the same behavior can be provided for RuntimeConfig?

Additional information

  • Would you be willing to help implement this feature?
@maou-shonen maou-shonen changed the title RuntimeConfig unknown property is unknown RuntimeConfig property is unknown May 19, 2023
@Hebilicious Hebilicious added bug Something isn't working needs reproduction and removed pending triage labels Jun 30, 2023 — with Volta.net
Copy link
Contributor

@maou-shonen Could you provide more information / a reproduction please ?

@McPizza0
Copy link
Contributor

McPizza0 commented Sep 8, 2023

@Hebilicious
I can replicate this

My runtimeConfig is as follows:

runtimeConfig: {
    key1: 'value1',
    key2: 'value2',
    key3: 'value3',
 }

When using useRuntimeConfig() none of the keys are present (only app & nitro are).
When using useRuntimeConfig().key1 type is returned as any/unknown.
useRuntimeConfig().randomWrongKeyName does not throw any type errors.

@Hebilicious
Copy link
Contributor

@Hebilicious I can replicate this

My runtimeConfig is as follows:

runtimeConfig: {
    key1: 'value1',
    key2: 'value2',
    key3: 'value3',
 }

When using useRuntimeConfig() none of the keys are present (only app & nitro are). When using useRuntimeConfig().key1 type is returned as any/unknown. useRuntimeConfig().randomWrongKeyName does not throw any type errors.

Could you please provide a reproduction ? 🙏🏽

@McPizza0
Copy link
Contributor

McPizza0 commented Sep 8, 2023

https://codesandbox.io/p/sandbox/nitro-5jssbm?file=/routes/api/hello.ts:4,24

check type of key1
check keys under config

@pi0
Copy link
Member

pi0 commented Sep 8, 2023

I think the idea is to automatically generate runtime config types from nitro.config as reference similar to Nuxt.

@McPizza0
Copy link
Contributor

McPizza0 commented Sep 8, 2023

100% as @pi0 said

Coming from nuxt, I thought runtime config would behave the same.

@Hebilicious
Copy link
Contributor

Understood, my bad I didn't realise this only worked in Nuxt.

@McPizza0
Copy link
Contributor

McPizza0 commented Sep 8, 2023

Me too, I thought it would have been in Nitro
Now realize its a feature request instead of bug

@McPizza0
Copy link
Contributor

McPizza0 commented Sep 8, 2023

can we close this in favor of #1706

@pi0 pi0 closed this as not planned Won't fix, can't repro, duplicate, stale Sep 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs reproduction
Projects
None yet
Development

No branches or pull requests

4 participants