**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.
This commit is contained in:
parent
dac3258265
commit
3dce27e951
1 changed files with 15 additions and 0 deletions
15
src/global.d.ts
vendored
Normal file
15
src/global.d.ts
vendored
Normal file
|
|
@ -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 {};
|
||||||
Loading…
Add table
Add a link
Reference in a new issue