Skip to content

v8.4.2

Choose a tag to compare

@github-actions github-actions released this 13 Oct 09:11
· 9 commits to master since this release
265e908

Changes

  • fix(positive-integer): 🐛 Extend PositiveNumber instead of Integer

Release details

Pull request notes

What

PositiveInteger now extends PositiveNumber instead of Integer. PositiveNumber validates the sign and PositiveInteger adds the integer check (InvalidIntegerError).

Behaviour changes

  • new PositiveInteger(1) instanceof Integer is now false. Code typing a parameter as Integer and passing a PositiveInteger will stop compiling. FileSize is the only consumer in this repo and is unaffected.
  • The sign is validated first, so new PositiveInteger(-0.5) throws InvalidPositiveNumberError (it used to throw InvalidIntegerError).
  • The % 1 === 0 check now exists in both Integer and PositiveInteger.

Docs and tests

docs/reference/positive-integer.md updated (signature and notes). Spec now asserts inheritance from PositiveNumber, no inheritance from Integer, and the new error for -0.5.

Verification

yarn test (717 tests) and yarn build pass. Coverage stays at 100%.