mirror of
https://github.com/FlipsideCrypto/DefinitelyTyped.git
synced 2026-02-06 10:56:53 +00:00
feat: Add globalThis (#40096)
This commit is contained in:
parent
3a19d3f7c9
commit
0410320f11
6
types/globalthis/globalthis-tests.ts
Normal file
6
types/globalthis/globalthis-tests.ts
Normal file
@ -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
|
||||
5
types/globalthis/implementation.d.ts
vendored
Normal file
5
types/globalthis/implementation.d.ts
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
/**
|
||||
* The `globalThis` object.
|
||||
*/
|
||||
declare const implementation: typeof globalThis;
|
||||
export = implementation;
|
||||
29
types/globalthis/index.d.ts
vendored
Normal file
29
types/globalthis/index.d.ts
vendored
Normal file
@ -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;
|
||||
7
types/globalthis/polyfill.d.ts
vendored
Normal file
7
types/globalthis/polyfill.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
import implementation = require('./implementation');
|
||||
|
||||
/**
|
||||
* Gets the `globalThis` object.
|
||||
*/
|
||||
declare function getPolyfill(): typeof implementation;
|
||||
export = getPolyfill;
|
||||
7
types/globalthis/shim.d.ts
vendored
Normal file
7
types/globalthis/shim.d.ts
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
import implementation = require('./implementation');
|
||||
|
||||
/**
|
||||
* Installs the `globalThis` property onto the global object.
|
||||
*/
|
||||
declare function shimGlobalThis(): typeof implementation;
|
||||
export = shimGlobalThis;
|
||||
22
types/globalthis/tsconfig.json
Normal file
22
types/globalthis/tsconfig.json
Normal file
@ -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"
|
||||
]
|
||||
}
|
||||
1
types/globalthis/tslint.json
Normal file
1
types/globalthis/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user