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: adjust AbortSignalLike to support native AbortSignal #250

Merged
merged 1 commit into from
Jul 15, 2022

Conversation

angeloashmore
Copy link
Member

@angeloashmore angeloashmore commented Jul 15, 2022

Types of changes

  • Chore (a non-breaking change which is related to package maintenance)
  • Bug fix (a non-breaking change which fixes an issue)
  • New feature (a non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Description

This PR fixes a bug where AbortSignalLike was incompatible with the native AbortSignal type.

The following TypeScript error is emitted when using the native AbortSignal type:

[tsserver 2739] [E] Type 'AbortSignal' is missing the following properties from type 'AbortSignalLike': reason, throwIfAborted

Background

globalThis.fetch uses an AbortSignal type within the typescript/lib/lib.dom.d.ts module that contains properties not present in the @types/node/globals.d.ts module. In practice, the wider type from @types/node/global.d.ts is sufficient and better integrates with real projects.

Checklist:

  • My change requires an update to the official documentation.
  • All TSDoc comments are up-to-date and new ones have been added where necessary.
  • All new and existing tests are passing.

🦆

@angeloashmore angeloashmore changed the title fix: looser AbortSignalLike typing to support native AbortSignal type fix: looser AbortSignalLike typing to support native AbortSignal type Jul 15, 2022
@github-actions
Copy link

size-limit report 📦

Path Size
dist/index.js 4.1 KB (0%)
dist/index.cjs 7 KB (0%)

@codecov-commenter
Copy link

Codecov Report

Merging #250 (4856e3e) into master (655e3d1) will not change coverage.
The diff coverage is 100.00%.

@@           Coverage Diff           @@
##           master     #250   +/-   ##
=======================================
  Coverage   99.46%   99.46%           
=======================================
  Files          23       23           
  Lines         377      377           
  Branches       76       76           
=======================================
  Hits          375      375           
  Partials        2        2           
Impacted Files Coverage Δ
src/client.ts 99.10% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 655e3d1...4856e3e. Read the comment docs.

@angeloashmore angeloashmore changed the title fix: looser AbortSignalLike typing to support native AbortSignal type fix: adjust AbortSignalLike to support native AbortSignal Jul 15, 2022
@angeloashmore angeloashmore merged commit 62fdae1 into master Jul 15, 2022
@angeloashmore angeloashmore deleted the aa/fix-abort-signal-like branch July 15, 2022 22:00
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.

2 participants