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

Support AbortSignal.timeout() #48003

Closed
5 tasks done
johanneswuerbach opened this issue Feb 22, 2022 · 6 comments
Closed
5 tasks done

Support AbortSignal.timeout() #48003

johanneswuerbach opened this issue Feb 22, 2022 · 6 comments
Labels
Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this
Milestone

Comments

@johanneswuerbach
Copy link

Suggestion

Add support for whatwg/dom#1032 to the AbortSignal types.

πŸ” Search Terms

AbortSignal, abort signal, timeout

βœ… Viability Checklist

My suggestion meets these guidelines:

  • This wouldn't be a breaking change in existing TypeScript/JavaScript code
  • This wouldn't change the runtime behavior of existing JavaScript code
  • This could be implemented without emitting different JS based on the types of the expressions
  • This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, new syntax sugar for JS, etc.)
  • This feature would agree with the rest of TypeScript's Design Goals.

⭐ Suggestion

πŸ“ƒ Motivating Example

The implementation in NodeJS nodejs/node#40899

πŸ’» Use Cases

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Domain: lib.d.ts The issue relates to the different libraries shipped with TypeScript Help Wanted You can do this labels Feb 23, 2022
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Feb 23, 2022
@huytd
Copy link
Contributor

huytd commented Mar 31, 2022

I think it is the same issue as #48444, looks like AbortSignal.timeout hasn't made it to the major browsers yet.

Here are the implementation tickets from the browsers:

cc @orta @saschanaz

@malobre
Copy link

malobre commented Jun 17, 2022

This feature has now shipped in (at least) Chrome, Firefox & Safari: https://chromestatus.com/feature/5768400507764736.

@blake-regalia
Copy link

This is now supported by all major browsers across the board. It's time to add the type.

@saschanaz
Copy link
Contributor

The type has been there for a while in https://github.com/microsoft/TypeScript-DOM-lib-generator/, the remaining work is to fetch that lib here.

If you are in hurry, you can try https://www.npmjs.com/package/@types/web instead of waiting for a new TS release.

@ianschmitz
Copy link

This is in the latest TypeScript. It appears to have been introduced in 4.9.5. See example: https://www.typescriptlang.org/play?ts=4.9.5#code/IIIw9gTgLgyglgcwHYEMA2A6KcC2BTMAVygAoBWABioEog

I think this ticket can be closed as completed.

@jakebailey
Copy link
Member

Done in #50884.

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

Successfully merging a pull request may close this issue.

8 participants