diff options
author | 2023-06-02 12:43:03 -0700 | |
---|---|---|
committer | 2023-06-02 12:43:03 -0700 | |
commit | ca2b19604932996205047fb65f4b2af4c9327ed8 (patch) | |
tree | d6737d49e2ab42c9d40833d0ed231593895750a6 | |
parent | 68a50278ba74dccd6f6c5378911ef62ff6a42506 (diff) | |
download | bun-xHyroM/types/expose-Bun-Env.tar.gz bun-xHyroM/types/expose-Bun-Env.tar.zst bun-xHyroM/types/expose-Bun-Env.zip |
Support NodeJS.ProcessEnv as wellxHyroM/types/expose-Bun-Env
-rw-r--r-- | packages/bun-types/bun.d.ts | 6 | ||||
-rw-r--r-- | packages/bun-types/globals.d.ts | 2 | ||||
-rw-r--r-- | packages/bun-types/tests/env.test-d.ts | 26 |
3 files changed, 20 insertions, 14 deletions
diff --git a/packages/bun-types/bun.d.ts b/packages/bun-types/bun.d.ts index a4992cea8..80d3f63d3 100644 --- a/packages/bun-types/bun.d.ts +++ b/packages/bun-types/bun.d.ts @@ -22,8 +22,8 @@ interface VoidFunction { declare module "bun" { type ArrayBufferView = TypedArray | DataView; import { Encoding as CryptoEncoding } from "crypto"; - - export interface Env extends Dict<string> { + + export interface Env extends Dict<string>, NodeJS.ProcessEnv { NODE_ENV: string; /** @@ -41,7 +41,7 @@ declare module "bun" { */ TZ?: string; } - + /** * The environment variables of the process * diff --git a/packages/bun-types/globals.d.ts b/packages/bun-types/globals.d.ts index f99378101..8a38798ba 100644 --- a/packages/bun-types/globals.d.ts +++ b/packages/bun-types/globals.d.ts @@ -187,6 +187,8 @@ declare namespace NodeJS { (id: string): any; resolve: RequireResolve; } + + interface ProcessEnv {} type Signals = | "SIGABRT" | "SIGALRM" diff --git a/packages/bun-types/tests/env.test-d.ts b/packages/bun-types/tests/env.test-d.ts index a09d7c596..d78fccc5b 100644 --- a/packages/bun-types/tests/env.test-d.ts +++ b/packages/bun-types/tests/env.test-d.ts @@ -2,19 +2,23 @@ import { expectType } from "tsd"; declare module "bun" { export interface Env { - WHATEVER: "WHATEVER"; + FOO: "FOO"; } } -expectType<"WHATEVER">(process.env.WHATEVER); +declare global { + namespace NodeJS { + interface ProcessEnv { + BAR: "BAR"; + } + } +} -export {}; -new Bun.Transpiler({ - macro: { - "react-relay": { - graphql: "bun-macro-relay/bun-macro-relay.tsx", - }, - }, -}); +expectType<"FOO">(process.env.FOO); +expectType<"BAR">(process.env.BAR); -Event; +process.env.FOO; +process.env.BAR; +process.env.OTHER; +Bun.env.FOO; +Bun.env.BAR; |