summaryrefslogtreecommitdiff
path: root/std/node/global.d.ts
diff options
context:
space:
mode:
authorSteven Guerrero <stephenguerrero43@gmail.com>2020-11-19 07:23:42 -0500
committerGitHub <noreply@github.com>2020-11-19 07:23:42 -0500
commit315d889afa38e976b106a3769cab206db31d5ce8 (patch)
treeb3243c90f6678cb6d2909bc9f6acceb412b21a6f /std/node/global.d.ts
parente3c3fc58cbc5053866928d33ffe25340c2bacc02 (diff)
fix(std/node): correct typings for global, globalThis, window (#8363)
Diffstat (limited to 'std/node/global.d.ts')
-rw-r--r--std/node/global.d.ts28
1 files changed, 28 insertions, 0 deletions
diff --git a/std/node/global.d.ts b/std/node/global.d.ts
new file mode 100644
index 000000000..b02a682c6
--- /dev/null
+++ b/std/node/global.d.ts
@@ -0,0 +1,28 @@
+// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
+import { process as processModule } from "./process.ts";
+import { Buffer as bufferModule } from "./buffer.ts";
+
+// d.ts files allow us to declare Buffer as a value and as a type
+// type something = Buffer | something_else; is quite common
+
+type GlobalType = {
+ process: typeof processModule;
+ Buffer: typeof bufferModule;
+};
+
+declare global {
+ interface Window {
+ global: GlobalType;
+ }
+
+ interface globalThis {
+ global: GlobalType;
+ }
+
+ var global: GlobalType;
+ var process: typeof processModule;
+ var Buffer: typeof bufferModule;
+ type Buffer = bufferModule;
+}
+
+export {};