From 3dce27e9515014de7effb16c6875e33c5ec3076d Mon Sep 17 00:00:00 2001 From: David Snelling Date: Fri, 20 Jun 2025 10:56:37 -0700 Subject: [PATCH] **feat: add global type declarations for environment detection** ### Changes: - Introduced `global.d.ts` to define global type declarations for the `globalThis` interface. - Added `__ENV__` object with the following properties: - `isBrowser: boolean` - `isNode: string | false` - `isServerless: boolean` - Included an export statement to ensure the file is treated as a module. ### Purpose: Defined global environment properties to standardize and enhance environment detection across browser, Node.js, and serverless environments. This improves type safety and consistency in the codebase. --- src/global.d.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 src/global.d.ts diff --git a/src/global.d.ts b/src/global.d.ts new file mode 100644 index 00000000..5b172476 --- /dev/null +++ b/src/global.d.ts @@ -0,0 +1,15 @@ +/** + * Global type declarations for Brainy + */ + +// Extend the globalThis interface to include the __ENV__ property +declare global { + var __ENV__: { + isBrowser: boolean; + isNode: string | false; + isServerless: boolean; + }; +} + +// This export is needed to make this file a module +export {};