t3-oss / t3-env

https://env.t3.gg
MIT License
2.45k stars 79 forks source link

Cannot find types for `@t3-oss/env-core` when using with Bun #212

Closed skoshx closed 3 months ago

skoshx commented 3 months ago

Repro:

$ bun install @t3-oss/env-core

Create file env.ts:

import { createEnv } from "@t3-oss/env-core";

This gives the error:

Screenshot 2024-03-30 at 3 45 48

My current workaround:

// @ts-ignore
import { createEnv } from "@t3-oss/env-core";
import { createEnv as typedCreateEnv } from "@t3-oss/env-core/dist/index"
import { z } from "zod"

export const env = (createEnv as typeof typedCreateEnv)({
  clientPrefix: 'PUBLIC_',
  server: {
    TOP_SECRET: z.string().min(1)
  },
  client: {},
  runtimeEnv: process.env,
  emptyStringAsUndefined: true,
})
juliusmarminge commented 3 months ago

image