Merge pull request #12696 from skysteve/promise-polyfill

promise-polyfill types
This commit is contained in:
Nathan Shively-Sanders
2016-11-22 15:38:24 -08:00
committed by GitHub
3 changed files with 43 additions and 0 deletions
+6
View File
@@ -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));
+19
View File
@@ -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"
]
}