mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-02-03 15:37:31 +00:00
Merge pull request #32103 from BendingBender/when-dom-ready
[when-dom-ready] Add types
This commit is contained in:
commit
a186f2edf2
13
types/when-dom-ready/index.d.ts
vendored
Normal file
13
types/when-dom-ready/index.d.ts
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
// Type definitions for when-dom-ready 1.2
|
||||
// Project: https://github.com/lukechilds/when-dom-ready
|
||||
// Definitions by: BendingBender <https://github.com/BendingBender>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export = whenDomReady;
|
||||
|
||||
declare function whenDomReady(document?: EventTarget): Promise<void>;
|
||||
declare function whenDomReady(callback?: () => void, document?: EventTarget): Promise<void>;
|
||||
|
||||
declare namespace whenDomReady {
|
||||
function resume<T>(document?: EventTarget): (value: T) => Promise<T>;
|
||||
}
|
||||
24
types/when-dom-ready/tsconfig.json
Normal file
24
types/when-dom-ready/tsconfig.json
Normal file
@ -0,0 +1,24 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"when-dom-ready-tests.ts"
|
||||
]
|
||||
}
|
||||
1
types/when-dom-ready/tslint.json
Normal file
1
types/when-dom-ready/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
7
types/when-dom-ready/when-dom-ready-tests.ts
Normal file
7
types/when-dom-ready/when-dom-ready-tests.ts
Normal file
@ -0,0 +1,7 @@
|
||||
import whenDomReady = require('when-dom-ready');
|
||||
|
||||
whenDomReady(); // $ExpectType Promise<void>
|
||||
whenDomReady(document); // $ExpectType Promise<void>
|
||||
whenDomReady(() => {}, document); // $ExpectType Promise<void>
|
||||
|
||||
Promise.resolve('foo').then(whenDomReady.resume<string>(document)); // $ExpectType Promise<string>
|
||||
Loading…
Reference in New Issue
Block a user