AbortSignal Error with @types/arcgis-js-api 4.9 and esri-loader 2.5

1081
3
10-03-2018 02:41 PM
DanielBula1
New Contributor

Hi everyone,

I'm working in a project withAngular 5, i was working with this libraries in the versions:

@types/arcgi-js-api 4.6

esri-loader 2.3

And everything was worked fine until i updated it to versions:

@types/arcgi-js-api 4.9

esri-loader 2.5

I'm getting this error message with not a clue when deploying with "ng serve":

ERROR in node_modules/@types/arcgis-js-api/index.d.ts(26317,14): error TS2304: Cannot find name 'AbortSignal'.

How can i solve this issue?

Thanks in advance for your help.

0 Kudos
3 Replies
ReneRubalcava
Frequent Contributor

I'm not sure what version of TypeScript is being used by that version of angular-cli, but you may need to update it. I'm not sure when the AbortController and AbortSignal types were added to TS, but try to upgrade it and see if that works.

The repo that has the typings lists TS 2.7 as a minimum. jsapi-resources/4.x/typescript at master · Esri/jsapi-resources · GitHub 

ReneRubalcava
Frequent Contributor

If you are unfamiliar with AbortSignal, it's a way that you can cancel requests. It's an option to esri/request. I'm not sure how useful it is for users of the API, but we use it internally to do things like abort requests for tiles when you might zoom on before they have been returned. It's fairly low level, but interesting nonetheless.

0 Kudos
TJRockefeller
New Contributor III

I checked the page describing AbortSignal, and at the very top of the page is this warning,

This is an experimental technology
Check the Browser compatibility table carefully before using this in production.

I am having a similar issue to the original poster, but not because my Typescript version is out of date (we are using 3.1.3), but I think it is because we are targeting ES5 to try to maintain at least marginal IE11 support.

Are there any known work arounds or shims for AbortSignal so that we can continue targeting ES5?

**EDIT**

Sorry for this mixup, we were actually using an older typscript version. Visual Studio Code was using 3.1.3, but our project was referencing version 2.3

0 Kudos