Property 'finally' does not exist on type 'Promise<void>'
For TypeScript 3.3.3
, just add es2018.promise
to your tsconfig.json
- compilerOptions.lib
config like this:
"lib": ["es2015", "es2016", "dom", "es2018.promise"]
If you use vscode
, maybe you should reload window
after adding this option to your tsconfig.json
file
ES2018 support was not added until TypeScript 2.7. Upgrading to that version or later resolves this error.
While TypeScript 2.7 might support it you need to target: "ESNEXT" in your tsconfig.json.
Which means that your code will probably not run in older browsers or node.js versions.
I'm using:
"@types/promise.prototype.finally": "^2.0.2"
import { shim as finallyShim } from 'promise.prototype.finally';
finallyShim();