By default there does not exist a finally block on promises. To use a finally block on your promise you could use the promise.prototype.finally shim.

Follow these steps to get it working:

1. Install promise.prototype.finally

npm install --save promise.prototype.finally

2. Install the typings

npm install --save-dev @types/promise.prototype.finally

3. Import the shim in your app.module.ts and initialize it

import { shim } from 'promise.prototype.finally';

4. Now you can use it the following way:

function().then(response => {
    // do something

  }).catch(error => {
    // do error handling

  }).finally(() => {

    // do it in every case