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

Empty extends array introduces type error TS2339 #179

Open
rydkvist opened this issue Jan 31, 2024 · 1 comment
Open

Empty extends array introduces type error TS2339 #179

rydkvist opened this issue Jan 31, 2024 · 1 comment
Labels
bug - p0 bug with very low priority and is unlikely to cause issues

Comments

@rydkvist
Copy link

Background

Hi there! I'm having the following compile error TS2339 when I keep the extends key as an empty array.

The workaround I've found is simply removing the extends key, which of course makes sense if I'm not using it. But I wasn't expecting it to introduce compile errors for the environment variables for keeping the extends key around, for perhaps future use of it.

image

My environment config

const env = createEnv({
  client: {
    ...
  },
  server: {
    APP_ENV: z.string(),
    APP_NAME: z.string().min(1),
    ...
  },
  shared: {
    NODE_ENV: z.enum(['development', 'production']),
  },
  runtimeEnv: {
    APP_ENV: process.env.APP_ENV,
    APP_NAME: process.env.APP_NAME,
    ...
  },
  extends: [],
});

Relevant Package Versions

  • t3-env pkg v0.8.0
  • Next.js pkg v13.4.19
  • TypeScript pkgv5.2.2

Project tsconfig settings:

{
  "compilerOptions": {
    "target": "ES2020",
    "lib": ["DOM", "DOM.Iterable", "ESNext"],
    "allowJs": true,
    "skipLibCheck": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "noEmit": true,
    "esModuleInterop": true,
    "module": "ESNext",
    "moduleResolution": "Bundler",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "jsx": "preserve",
    "incremental": true,
    "preserveConstEnums": true,
    "declaration": false,
    "baseUrl": ".",
    "paths": {
      "@/*": ["src/*"],
      "@env": ["./env.ts"]
    }
  },
  "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"],
  "exclude": ["node_modules"]
}
@juliusmarminge
Copy link
Member

don't see a real issue here since you can just remove the empty array if you're not extending anything. obviously open for a fix if anyone wants to spend time on it but i probably wont fix it myself tbh...

@juliusmarminge juliusmarminge added bug Something isn't working bug - p0 bug with very low priority and is unlikely to cause issues and removed bug Something isn't working labels Feb 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug - p0 bug with very low priority and is unlikely to cause issues
Projects
None yet
Development

No branches or pull requests

2 participants