-
Notifications
You must be signed in to change notification settings - Fork 6
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
The inferred type cannot be named without a reference to '../node_modules/znv/dist/util'. #12
Comments
Hi there. Does this problem reproduce for you using Node and npm (or yarn or pnpm) instead of Bun? If yes, could you share a minimal reproduction project? Ideally one that doesn't include any source files besides the one you've included here and that only depends on |
I can see the same error when I use I added the same |
Please share a minimal reproduction repo if you can! I'm unlikely to be able to diagnose the problem without being able to investigate the specific circumstances under which it occurs. |
Tagging @BowlingX who added ES Modules support, just in case it's related |
I can have a look, did not encounter the issue yet. |
I'm unable to reproduce the issue with |
I have exactly one znv instance. And after changing One thing worth noting is that this error does not occur with the What's annoying is that I can't ts-ignore this as mentioned in the upstream issue 😢 |
Is it possible that you have different typescript versions? |
No, I have only one typescript with same version and hash |
facing the same issue, any updates? // tsconfig.json
{
"$schema": "https://json.schemastore.org/tsconfig",
"display": "Default",
"compilerOptions": {
"composite": false,
"declaration": true,
"declarationMap": true,
"esModuleInterop": true,
"forceConsistentCasingInFileNames": true,
"inlineSources": false,
"isolatedModules": true,
"module": "NodeNext",
"moduleResolution": "NodeNext",
"noUnusedLocals": false,
"noUnusedParameters": false,
"preserveWatchOutput": true,
"skipLibCheck": true,
"strict": true,
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["src/**/*.ts", "./*.js", ".eslintrc.cjs"],
"exclude": ["node_modules"]
} // env.ts
import { parseEnv, z } from 'znv';
export const env = parseEnv(process.env, {
NODE_ENV: z.enum(['development', 'production']),
PORT: z.number(),
ACCESS_TOKEN_EXPIRATION: z.number().optional(),
}); |
Hey there, per this issue comment on the TypeScript repo and the comment directly preceding it, it appears that in some situations this may be a bug that could be fixed in the upcoming TypeScript 5.5 release. Maybe you could try the 5.5 beta to see if it fixes your problem? (See also the relevant section of the 5.5 beta release notes.) Failing that, the TypeScript devs have written up a more detailed explanation of some of the (legitimate) manifestations of this error message here: microsoft/TypeScript#58176 (comment) |
@lostfictions I believe this can be resolved by adding Typescript can only reference types explicitly exported in package.json. The types returned by |
Hello there,
The following code:
yields the following TypeScript warning:
Has anyone encountered the same thing? Not really sure how to fix this. I am using Bun. My tsconfig:
Thank you!
The text was updated successfully, but these errors were encountered: