Skip to content

The inferred type cannot be named without a reference to '../node_modules/znv/dist/util'. #12

@adicco

Description

@adicco

Hello there,

The following code:

import { parseEnv } from 'znv';
import { z } from 'zod';

export const {
  DEFAULT_ADMIN_EMAILS,
 } = parseEnv(process.env, {
   DEFAULT_ADMIN_EMAILS: z
    .string()
    .optional()
    .transform((val) => {
      return val ? val.split(',') : [];
    }),
 });

yields the following TypeScript warning:

The inferred type of 'DEFAULT_ADMIN_EMAILS' cannot be named without a reference to '../node_modules/znv/dist/util'. This is likely not portable. A type annotation is necessary. 

Has anyone encountered the same thing? Not really sure how to fix this. I am using Bun. My tsconfig:

{
  "compilerOptions": {

    "lib": ["ESNext"],
    "module": "esnext",
    "target": "esnext",
    "moduleResolution": "bundler",
    "noEmit": true,
    "allowImportingTsExtensions": true,
    "moduleDetection": "force",

   
    "jsx": "react",
    "jsxFactory": "Html.createElement",
    "jsxFragmentFactory": "Html.Fragment",
    "baseUrl": "./src",

   
    "paths": {
      "~/*": ["./src/*"]
    },
 
    "types": [
      "bun-types",
      "typed-htmx"
    ],

    "allowJs": true,
    "strict": true,
    "forceConsistentCasingInFileNames": true,
    "skipLibCheck": true,
    "composite": true,
    "downlevelIteration": true,
    "allowSyntheticDefaultImports": true
  }
}

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions