mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-08-16 23:10:29 +00:00
feat: Add globalThis (#40096)
This commit is contained in:
committed by
Nathan Shively-Sanders
parent
3a19d3f7c9
commit
0410320f11
@@ -0,0 +1,6 @@
|
||||
import getGlobal = require('globalthis');
|
||||
|
||||
getGlobal(); // $ExpectType typeof globalThis
|
||||
getGlobal.implementation; // $ExpectType typeof globalThis
|
||||
getGlobal.getPolyfill; // $ExpectType () => typeof globalThis
|
||||
getGlobal.shim; // $ExpectType () => typeof globalThis
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
/**
|
||||
* The `globalThis` object.
|
||||
*/
|
||||
declare const implementation: typeof globalThis;
|
||||
export = implementation;
|
||||
Vendored
+29
@@ -0,0 +1,29 @@
|
||||
// Type definitions for globalthis 1.0
|
||||
// Project: https://github.com/ljharb/System.global#readme
|
||||
// Definitions by: ExE Boss <https://github.com/ExE-Boss>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 3.4
|
||||
|
||||
/**
|
||||
* Gets the `globalThis` object.
|
||||
*/
|
||||
declare function getGlobal(): typeof globalThis;
|
||||
|
||||
declare namespace getGlobal {
|
||||
/**
|
||||
* Gets the `globalThis` object.
|
||||
*/
|
||||
function getPolyfill(): ReturnType<typeof import('./polyfill')>;
|
||||
|
||||
/**
|
||||
* The `globalThis` object.
|
||||
*/
|
||||
const implementation: typeof import('./implementation');
|
||||
|
||||
/**
|
||||
* Installs the `globalThis` property onto the global object.
|
||||
*/
|
||||
function shim(): ReturnType<typeof import('./shim')>;
|
||||
}
|
||||
|
||||
export = getGlobal;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
import implementation = require('./implementation');
|
||||
|
||||
/**
|
||||
* Gets the `globalThis` object.
|
||||
*/
|
||||
declare function getPolyfill(): typeof implementation;
|
||||
export = getPolyfill;
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
import implementation = require('./implementation');
|
||||
|
||||
/**
|
||||
* Installs the `globalThis` property onto the global object.
|
||||
*/
|
||||
declare function shimGlobalThis(): typeof implementation;
|
||||
export = shimGlobalThis;
|
||||
@@ -0,0 +1,22 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": ["es5"],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictFunctionTypes": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": ["../"],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"implementation.d.ts",
|
||||
"index.d.ts",
|
||||
"polyfill.d.ts",
|
||||
"shim.d.ts",
|
||||
"globalthis-tests.ts"
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Reference in New Issue
Block a user