Releases: chuigda/TypeAssert
Releases · chuigda/TypeAssert
Release DELTA3
New functionalities
- Now you can write assertions with the help of
RefTyfromresolvermodule, and useresolveTypeReferencesto 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
typeAssertnow generates JavaScriptErrorobjects instead of just stringspreventErrTracefunctions and parameters have been purged since they're not used anymore
Release DELTA2
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
assertObjectValueto 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
undefinedis now also considered a kind ofnull:
typeAssert(null, 'number?')
typeAssert(undefined, 'number?') // fails in previous editions, passes nowchainWithnow 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
Release CHARLIE1
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,.chainWithand.assertValue) not enabled by default - Use
enableChainAPIto explicitly enable these APIs - Provide argument to
enableChainAPIto use your custom name, instead of the default onesenableChainAPI({ 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
sumWithno more incorrectly print traces when one of its branch fails
Semantic versioning 屁用没有(
Release BRAVO1
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
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.