TypeScript Version: 3.4.0-dev.201xxxxx
Search Terms:
- "promise"
- "finally"
- "promise finally"
Code
// A *self-contained* demonstration of the problem follows...
// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.
let myCmpt = 1
const myPromise = new Promise((fulfill, _reject) => {
setTimeout(() => fulfill(true), 1000)
}).finally(() => myCmpt--)
Expected behavior:
Code should compile.
Actual behavior:
I get error:
tsBug.ts:4:17 - error TS2322: Type 'number' is not assignable to type 'void'.
4 }).finally(() => myCmpt--)
~~~~~~~~
../../../../../usr/local/lib/node_modules/typescript/lib/lib.es2018.promise.d.ts:31:26
31 finally(onfinally?: (() => void) | undefined | null): Promise<T>
~~~~~~~~~~
The expected type comes from the return type of this signature.
Found 1 error.
Playground Link:
Couldn't manage to use es2018 with TypeScript Playground.
Related Issues:
TypeScript Version: 3.4.0-dev.201xxxxx
Search Terms:
Code
Expected behavior:
Code should compile.
Actual behavior:
I get error:
Playground Link:
Couldn't manage to use es2018 with TypeScript Playground.
Related Issues: