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

fix(AbortError): added type guard #10

Merged
merged 3 commits into from
Sep 30, 2022

Conversation

atassis
Copy link
Contributor

@atassis atassis commented Sep 28, 2022

added type guard, fixed type in function

added type guard, fixed type in function
@aikoven
Copy link
Contributor

aikoven commented Sep 30, 2022

There are many different AbortErrors, one of which comes from the DOM API. It's constructor is not even accessible through globals, so there's no way to use instanceof with it. Instead, the web platform instructs to check if an error is an instance of AbortError using error.name === 'AbortError'.

So this change would break isAbortError when built-in AbortError is passed in. Also consider that NodeJS has its own AbortError class. We'd like the isAbortError to work with instances of any of them.

instanceof checks would also break in case when AbortError instance is coming from a different installed version of abort-controller-x package.

@atassis atassis changed the title fix(AbortError): stricter type checking fix(AbortError): added type guard Sep 30, 2022
@aikoven aikoven merged commit 05958d5 into deeplay-io:master Sep 30, 2022
@aikoven
Copy link
Contributor

aikoven commented Sep 30, 2022

Published 📦 abort-controller-x@0.4.1

@atassis atassis deleted the fix/is-abort-error-type-guard branch September 30, 2022 05:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants