mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-12-06 13:11:46 +00:00
Merge pull request #12696 from skysteve/promise-polyfill
promise-polyfill types
This commit is contained in:
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
// Type definitions for promise v6.0.2
|
||||
// Project: https://www.npmjs.com/package/promise-polyfill
|
||||
// Definitions by: Steve Jenkins <https://github.com/skysteve>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
export default Promise;
|
||||
@@ -0,0 +1,18 @@
|
||||
const prom1 = new Promise<number>((resolve, reject) => {
|
||||
resolve(12);
|
||||
});
|
||||
|
||||
const prom2 = new Promise<string>((resolve, reject) => {
|
||||
reject('an error');
|
||||
}).then((val) => {
|
||||
console.log(val);
|
||||
return val;
|
||||
}).catch((err) => {
|
||||
console.error(err);
|
||||
});
|
||||
|
||||
Promise.all([prom1, prom2])
|
||||
.then(result => {
|
||||
console.log(result);
|
||||
}, (exception) => console.error(exception))
|
||||
.catch((ex) => console.error(ex));
|
||||
@@ -0,0 +1,19 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"target": "es6",
|
||||
"noImplicitAny": true,
|
||||
"strictNullChecks": true,
|
||||
"baseUrl": "../",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"promise-polyfill-tests.ts"
|
||||
]
|
||||
}
|
||||
Reference in New Issue
Block a user