Skip to content

v2.0.0

Compare
Choose a tag to compare
@theScottyJam theScottyJam released this 03 Jun 04:12
· 14 commits to main since this release

Remove support for the "Infinity" primitive literal.

Moat Maker is supposed to mirror TypeScript syntax as closely as possible. Unfortunately, it was a little too relax in how it interpreted primitive literals and would allow Infinity and -Infinity to be provided as types even though TypeScript itself does not support using Infinity as a type. You can still make a validator expect Infinity or -Infinity to be present, you just have to interpolate those values into your validator as opposed to expecting type syntax to exist for it (the same has already been true for NaN).

// WRONG: support has been removed for this.
const myValidator = validator`{ value: Infinity }`;

// CORRECT: You can still interpolate Infinity in to match against it.
const myValidator = validator`{ value: ${Infinity} }`;

As this project is still extremely young and has only recently been released, the hope is that no one has written code yet that relies on this somewhat niche behavior. Breaking changes like this may not be possible in the future.