Skip to content

Commit

Permalink
fix: use globalThis instead of global (#9)
Browse files Browse the repository at this point in the history
* fix: use globalThis instead of global

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/globalThis

* fix: replace all occurrences of global
  • Loading branch information
lukashass committed Jan 27, 2022
1 parent 8e92ac5 commit 3f4aa70
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/getEnvConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ export interface EnvConfig {
}

export function getEnvConfig<T extends keyof EnvConfig>(key: keyof EnvConfig): EnvConfig[T] | undefined {
const _window = global.window as unknown as { env?: EnvConfig };
const _window = globalThis.window as unknown as { env?: EnvConfig };
if (_window?.env) {
return _window.env[key];
}
if (global.process?.env) {
return global.process.env[key];
if (globalThis.process?.env) {
return globalThis.process.env[key];
}
}

0 comments on commit 3f4aa70

Please sign in to comment.