# What changed in p-cancelable

> 12 changes in p-cancelable 2 to 5 from its official release notes, upgrade guides and advisories: 6 breaking. Each one cited. Sources checked 2026-11-05. HTML: https://unstale.sh/npm/p-cancelable/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## p-cancelable 5

### Breaking changes

- Node.js 22 is now required to use p-cancelable. (3.0.0, 5.0.0) — [release notes](https://github.com/sindresorhus/p-cancelable/releases/tag/v5.0.0), [release notes](https://github.com/sindresorhus/p-cancelable/releases/tag/v3.0.0)

### Behavior and default changes

- Cancellation is allowed while an adopted promise is pending. (5.0.0) — [release notes](https://github.com/sindresorhus/p-cancelable/releases/tag/v5.0.0)

### Fixes and other changes

- Errors are preserved during resolution and cancellation. (5.0.0) — [release notes](https://github.com/sindresorhus/p-cancelable/releases/tag/v5.0.0)
- Types no longer claim that static Promise methods exist on PCancelable. (5.0.0) — [release notes](https://github.com/sindresorhus/p-cancelable/releases/tag/v5.0.0)
- All cancel handlers run even if one throws. (5.0.0) — [release notes](https://github.com/sindresorhus/p-cancelable/releases/tag/v5.0.0)
- The state is settled when the executor throws. (5.0.0) — [release notes](https://github.com/sindresorhus/p-cancelable/releases/tag/v5.0.0)

## p-cancelable 4

### Breaking changes

- Node.js 14 is now required to use p-cancelable. (4.0.0) — [release notes](https://github.com/sindresorhus/p-cancelable/releases/tag/v4.0.0)

### Fixes and other changes

- The error message is improved when attaching onCancel after the promise has settled. (4.0.0) — [release notes](https://github.com/sindresorhus/p-cancelable/releases/tag/v4.0.0)

## p-cancelable 3

### Breaking changes

- The package is now pure ESM, so developers must use it as an ES module. (3.0.0) — [release notes](https://github.com/sindresorhus/p-cancelable/releases/tag/v3.0.0)

## p-cancelable 2

### Breaking changes

- Node.js 8 is now required. (2.0.0) — [release notes](https://github.com/sindresorhus/p-cancelable/releases/tag/v2.0.0)
- Calling onCancel after the promise settles now throws an error. (2.0.0) — [release notes](https://github.com/sindresorhus/p-cancelable/releases/tag/v2.0.0)
- The TypeScript definition now uses a CommonJS-compatible export; TypeScript users need to switch to the require-style import. (2.0.0) — [release notes](https://github.com/sindresorhus/p-cancelable/releases/tag/v2.0.0)
