Skip to content

Releases: chuigda/TypeAssert

Release DELTA3

23 Apr 03:37
Compare
Choose a tag to compare
Release DELTA3 Pre-release
Pre-release

New functionalities

  • Now you can write assertions with the help of RefTy from resolver module, and use resolveTypeReferences to resolve them. This is still very experimental and any issue report is welecomed
const asserts = {}
asserts.assertion1 = { x: new RefTy('assertion2') }
asserts.assertion2 = ['number']

resolveTypeReferences(asserts)

Breaking changes

  • typeAssert now generates JavaScript Error objects instead of just strings
  • preventErrTrace functions and parameters have been purged since they're not used anymore

Release DELTA2

20 Sep 03:44
Compare
Choose a tag to compare
Release DELTA2 Pre-release
Pre-release

New functionalities

  • object value assertions: able to assert all values of a single object
typeAssert({ a: 114, b: 514 }, 'object'.assertObjectValue('number'))
// or
typeAssert({ a: 114, b: 514 }, {}.assertObjectValue('number'))
  • chaining assertObjectValue to a nullable assertion will yield a "nullable object value assertion":
typeAssert(null, 'object?'.assertObjectValue('number'))
// equivalent to:
typeAssert(null, 'object'.assertObjectValue('number').orNull())

Breaking changes

  • undefined is now also considered a kind of null:
typeAssert(null, 'number?')
typeAssert(undefined, 'number?') // fails in previous editions, passes now
  • chainWith now handles nullable assertions better
typeAssert(null, 'number?'.chainWith(x => x >= 100 || 'holy shit'))
// now equivalent to:
typeAssert(null, 'number'.chainWith(x => x >= 100 || 'holy shit').orNull())

Release CHARLIE2

05 Nov 05:46
c6ff845
Compare
Choose a tag to compare

Bug fixes

Fixed a bug in CHARLIE1, which made the "expected" and "got" inverted when asserting values.

Release CHARLIE1

13 Oct 13:35
Compare
Choose a tag to compare
Release CHARLIE1 Pre-release
Pre-release

New functionalities

  • value assertions: able to be directly chained after another assertion
    // before
    typeAssert(5, 'number'.chainWith(x => x === 5))
    // now
    typeAssert(5, 'number'.assertValue(5))

Enhancements & Breaking changes

  • Chaining API (.sumWith, .orNull, .chainWith and .assertValue) not enabled by default
  • Use enableChainAPI to explicitly enable these APIs
  • Provide argument to enableChainAPI to use your custom name, instead of the default ones
    enableChainAPI({ sumWith: 'anyName', orNull: 'youDesire', chainWith: 'isAlways', assertValue: 'okayToUse' })
    // or if you don't want to rename all of them
    enableChainAPI({ orNull: 'toNullable' })
  • Now you can turn off in-place at once type error tracing with preventErrTrace

Bug fixes

  • sumWith no more incorrectly print traces when one of its branch fails

Semantic versioning 屁用没有(

Release BRAVO1

27 Aug 03:50
c0758d5
Compare
Choose a tag to compare

This release comes with some improvements, bug-fixes and one new functionality: chained assertions.

Unfortunately, UMD not supported any more since I don't use that frontend tooling any more.

Release ALPHA1

03 Aug 07:30
0bb7d2e
Compare
Choose a tag to compare

This is the first release. Since this assertion library has been used for a while in my own projects, I think it is okay. Without bugs reported, this will be the last release.