aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/bun-types/bun.d.ts6
-rw-r--r--packages/bun-types/globals.d.ts1
-rw-r--r--packages/bun-types/tests/env.test-d.ts26
3 files changed, 19 insertions, 14 deletions
diff --git a/packages/bun-types/bun.d.ts b/packages/bun-types/bun.d.ts
index 7721a4846..079595b19 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..4ca1a8d3e 100644
--- a/packages/bun-types/globals.d.ts
+++ b/packages/bun-types/globals.d.ts
@@ -187,6 +187,7 @@ 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;