mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-07 00:07:07 +00:00
[bluebird-global] Amend .finally() and update docs for es5 target.
This commit is contained in:
Vendored
+18
-2
@@ -31,6 +31,22 @@
|
||||
* in the runtime. Do this by either importing bluebird.js via a `<script />` tag in your html or
|
||||
* via importing it in your js entry file AND assigning it to the global Promise symbol.
|
||||
*
|
||||
* c) if you're `--target`ing "es5", then you'll need to include the "es2015.iterable" lib typings to
|
||||
* let the bluebird.d.ts compile (requirement for Map, Iterable & friends). This is only for the
|
||||
* compile-time, since bluebird doesn't require these es6 features to be present in the runtime.
|
||||
* To summarise: when targeting "es5", make sure you have the follwing "lib" config in your tsconfig.json:
|
||||
*
|
||||
* {
|
||||
* "compilerOptions": {
|
||||
* "lib": [
|
||||
* "es5",
|
||||
* "es2015.iterable",
|
||||
* "dom"
|
||||
* (more, if you need...)
|
||||
* ],
|
||||
* }
|
||||
* }
|
||||
*
|
||||
* 3. Why so much effort?
|
||||
*
|
||||
* If a promise-polyfilling library wants to play nicely with TypeScript, it needs to augment
|
||||
@@ -38,7 +54,7 @@
|
||||
* For various reasons this couldn't be done in The `bluebird` typings.
|
||||
*
|
||||
* 4. Contributors: After changing this file please manually test these cases (via altering ./tsconfig.json ):
|
||||
* a. target es5, no `lib` key
|
||||
* a. target es5, with the following `lib` keys: "es5", "es2015.iterable", "dom"
|
||||
* b. target es6, no `lib` key
|
||||
* c. target es5, latest "es20xx", e.g. "es2017"
|
||||
* d. target es6, latest "es20xx", e.g. "es2017"
|
||||
@@ -128,7 +144,7 @@ declare global {
|
||||
/*
|
||||
* See comments above `then` for the reason why this is needed. Taken from esnext.promise.d.ts.
|
||||
*/
|
||||
finally(onfinally?: (() => void) | undefined | null): Bluebird<T>;
|
||||
finally(onfinally?: (() => void) | undefined | null): Promise<T>;
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es2017",
|
||||
"es2018",
|
||||
"dom"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
|
||||
Reference in New Issue
Block a user