diff --git a/promise-polyfill/index.d.ts b/promise-polyfill/index.d.ts new file mode 100644 index 0000000000..703f7a6a8c --- /dev/null +++ b/promise-polyfill/index.d.ts @@ -0,0 +1,6 @@ +// Type definitions for promise v6.0.2 +// Project: https://www.npmjs.com/package/promise-polyfill +// Definitions by: Steve Jenkins +// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped + +export default Promise; \ No newline at end of file diff --git a/promise-polyfill/promise-polyfill-tests.ts b/promise-polyfill/promise-polyfill-tests.ts new file mode 100644 index 0000000000..280a2bebdf --- /dev/null +++ b/promise-polyfill/promise-polyfill-tests.ts @@ -0,0 +1,18 @@ +const prom1 = new Promise((resolve, reject) => { + resolve(12); +}); + +const prom2 = new Promise((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)); \ No newline at end of file diff --git a/promise-polyfill/tsconfig.json b/promise-polyfill/tsconfig.json new file mode 100644 index 0000000000..d411c896d5 --- /dev/null +++ b/promise-polyfill/tsconfig.json @@ -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" + ] +} \ No newline at end of file