frontend/.pnpm-store/v3/files/97/fa63f5cce6c43ab7cc68604bce696d94abaa769b4181fc1268f60b975565708ecc26ddc54641acd7fb9bf4bc8752b144bb93e1f8402f92675ab3bcce6895e1

22 lines
688 B
Plaintext

/**
Declare locally scoped properties on `globalThis`.
When defining a global variable in a declaration file is inappropriate, it can be helpful to define a `type` or `interface` (say `ExtraGlobals`) with the global variable and then cast `globalThis` via code like `globalThis as unknown as ExtraGlobals`.
Instead of casting through `unknown`, you can update your `type` or `interface` to extend `GlobalThis` and then directly cast `globalThis`.
@example
```
import type {GlobalThis} from 'type-fest';
type ExtraGlobals = GlobalThis & {
readonly GLOBAL_TOKEN: string;
};
(globalThis as ExtraGlobals).GLOBAL_TOKEN;
```
@category Type
*/
export type GlobalThis = typeof globalThis;