-
Notifications
You must be signed in to change notification settings - Fork 2
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
Everything from Nuxt 3 Runtime Config is unknown #110
Comments
Hello can you provide a reproduction please ? you can use https://stackblitz.com/edit/nuxt-starter-uvbiaa?file=README.md . I need at least the package.json with the lockfile n order to debug it |
Yes, here's the reproduction: https://stackblitz.com/edit/nuxt-starter-geb6an?file=server%2Fplugins%2Fmongodb.ts Steps:
Then: |
I am having exactly the same issue, is there a fix coming? Thanks! |
that's strange, I can't reproduce it from https://stackblitz.com/edit/nuxt-starter-geb6an?file=server%2Fplugins%2Fmongodb.ts BTW V1 is coming soon. but i can do a release patch on 0.x if i can reproduce it. |
It's still reproducible for me, when I open the link, I have the TS error, as soon as I remove the 'nuxt-applicationinsights' from nuxt.config.ts, the TS error goes away. Tested the V1, still the same issue. Also I've found what's it caused by: in src/runtime/types.d.ts on line 5 the declaration is incorrect, if you change it to:
the types will start working. |
So i finally understood why i couldn't reproduce it. I was using pnpm. The workaround for now is to use pnpm as we need to investigate this specific issue in nuxt first. You can see the reason of augmenting |
which version of node and npm are you using ? |
I'm getting this issue on Node v20 and Node v22, did not test other versions. For packages Yarn 1.22 is used, but I don't think the issue is related to node or npm / yarn version. Most likely the types are just incorrectly implemented, but I don't know the right way of doing it as I never developed a Nuxt module before. I just know that changing it back to nuxt/schema "fixes" the "TS unknown" issue. Also when reproducing it, make sure that you are testing the types on server side (some server side plugin or some API endpoint) as I'm not sure if there's same issue on FE code. |
With the latest version 0.7.0 the Nuxt 3 build fails, because all types from Runtime Config are unknown, removing the nuxt-applicationinsights from nuxt.config modules fixes this.
Also downgrading the lib to 0.6.0 resolves this.
Error example:
error TS2322: Type '{ 'server-token': unknown; }' is not assignable to type 'HeadersInit | undefined'.
Types of property ''server-token'' are incompatible.
Type 'unknown' is not assignable to type 'string | undefined'.
26 headers: {
~~~~~~~
The text was updated successfully, but these errors were encountered: