diff options
| -rw-r--r-- | packages/bun-types/bun.d.ts | 43 | ||||
| -rw-r--r-- | packages/bun-types/child_process.d.ts | 2 | ||||
| -rw-r--r-- | packages/bun-types/globals.d.ts | 2 | ||||
| -rw-r--r-- | packages/bun-types/tests/env.test-d.ts | 8 |
4 files changed, 26 insertions, 29 deletions
diff --git a/packages/bun-types/bun.d.ts b/packages/bun-types/bun.d.ts index 40dce6bf4..7721a4846 100644 --- a/packages/bun-types/bun.d.ts +++ b/packages/bun-types/bun.d.ts @@ -2,27 +2,6 @@ interface VoidFunction { (): void; } -declare namespace Bun { - interface Env extends Dict<string> { - NODE_ENV: string; - - /** - * The timezone used by Intl, Date, etc. - * - * To change the timezone, set `Bun.env.TZ` or `process.env.TZ` to the time zone you want to use. - * - * You can view the current timezone with `Intl.DateTimeFormat().resolvedOptions().timeZone` - * - * @example - * ```js - * Bun.env.TZ = "America/Los_Angeles"; - * console.log(Intl.DateTimeFormat().resolvedOptions().timeZone); // "America/Los_Angeles" - * ``` - */ - TZ?: string; - } -} - /** * * Bun.js runtime APIs @@ -43,6 +22,26 @@ declare namespace Bun { declare module "bun" { type ArrayBufferView = TypedArray | DataView; import { Encoding as CryptoEncoding } from "crypto"; + + export interface Env extends Dict<string> { + NODE_ENV: string; + + /** + * The timezone used by Intl, Date, etc. + * + * To change the timezone, set `Bun.env.TZ` or `process.env.TZ` to the time zone you want to use. + * + * You can view the current timezone with `Intl.DateTimeFormat().resolvedOptions().timeZone` + * + * @example + * ```js + * Bun.env.TZ = "America/Los_Angeles"; + * console.log(Intl.DateTimeFormat().resolvedOptions().timeZone); // "America/Los_Angeles" + * ``` + */ + TZ?: string; + } + /** * The environment variables of the process * @@ -51,7 +50,7 @@ declare module "bun" { * Changes to `process.env` at runtime won't automatically be reflected in the default value. For that, you can pass `process.env` explicitly. * */ - export const env: Bun.Env; + export const env: Env; export const origin: string; /** diff --git a/packages/bun-types/child_process.d.ts b/packages/bun-types/child_process.d.ts index 04389986f..58dc69f06 100644 --- a/packages/bun-types/child_process.d.ts +++ b/packages/bun-types/child_process.d.ts @@ -704,7 +704,7 @@ declare module "child_process" { uid?: number | undefined; gid?: number | undefined; cwd?: string | URL | undefined; - env?: Partial<Bun.Env> | undefined; + env?: Partial<import("bun").Env> | undefined; } interface CommonOptions extends ProcessEnvOptions { /** diff --git a/packages/bun-types/globals.d.ts b/packages/bun-types/globals.d.ts index 47ccb85e7..f99378101 100644 --- a/packages/bun-types/globals.d.ts +++ b/packages/bun-types/globals.d.ts @@ -367,7 +367,7 @@ interface Process { platform: Platform; argv: string[]; execArgv: string[]; - env: Bun.Env; + env: import("bun").Env; /** Whether you are using Bun */ isBun: 1; // FIXME: this should actually return a boolean diff --git a/packages/bun-types/tests/env.test-d.ts b/packages/bun-types/tests/env.test-d.ts index c2611e1a7..a09d7c596 100644 --- a/packages/bun-types/tests/env.test-d.ts +++ b/packages/bun-types/tests/env.test-d.ts @@ -1,10 +1,8 @@ import { expectType } from "tsd"; -declare global { - namespace Bun { - interface Env { - WHATEVER: "WHATEVER"; - } +declare module "bun" { + export interface Env { + WHATEVER: "WHATEVER"; } } |
