Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move AbortController/AbortSignal to isolated lib file to share definitions between DOM and NodeJS #43692

Open
rbuckton opened this issue Apr 15, 2021 · 1 comment
Labels
Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript

Comments

@rbuckton
Copy link
Member

NodeJS introduced a global AbortController/AbortSignal in Node 15.x. It would be helpful if NodeJS could share the definitions from the DOM using /// <reference lib="abortcontroller" /> comment.

This was mentioned in https://github.com/DefinitelyTyped/DefinitelyTyped/pull/52357/files#diff-2696281f8832b1227bb41483a7525a8ccd9399bb4b1704f69c8c54bb1346d8edR315

Related: DefinitelyTyped/DefinitelyTyped#52357

@rbuckton rbuckton added the Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript label Apr 15, 2021
@ankon
Copy link

ankon commented Oct 22, 2021

For future googlers: AbortController already exists in 14.17 as "experimental", and seems to be needed to consume @types/node 14.17.28:

> tsc --outDir ${BUILD_DIR:-build}/plugins -p tsconfig.plugins.json

node_modules/@types/node/child_process.d.ts:267:18 - error TS2304: Cannot find name 'AbortSignal'.

267         signal?: AbortSignal | undefined;
                     ~~~~~~~~~~~


Found 1 error.

Adding a reference to the "dom" lib in tsconfig fixes that, but feels "wrong". Alternatively moving to ^14.17.0 <14.17.28 for the version of @types/node helps as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript
Projects
None yet
Development

No branches or pull requests

2 participants