- assertType<T>(subject): asserts subject is T
Returns asserts subject is T
- assertType<T>(subject, validator): asserts subject is T
Parameters
- subject: unknown
- validator: ((s: T) => boolean)
- (s): boolean
Returns boolean
Returns asserts subject is T
- assertType<T>(subject, classConstructor): asserts subject is InstanceType<T>
Type Parameters
- T extends (new (..._args: any[]) => any)
Parameters
- subject: unknown
- classConstructor: T
Returns asserts subject is InstanceType<T>
Methods
as
- as<T>(_subject): asserts _subject is T
Returns asserts _subject is T
custom
- custom<T>(validator): ((subject: unknown) => asserts subject is T)
Parameters
- validator: ((s: T) => boolean)
- (s): boolean
Returns boolean
Returns ((subject: unknown) => asserts subject is T)
- (subject): asserts subject is T
Returns asserts subject is T
isBoolean
- isBoolean(subject): asserts subject is boolean
Returns asserts subject is boolean
isError
- isError(subject): asserts subject is Error
Returns asserts subject is Error
isFalse
- isFalse(subject): asserts subject is false
Returns asserts subject is false
isNever
- isNever(_subject): asserts _subject is never
Returns asserts _subject is never
isNull
- isNull(subject): asserts subject is null
Returns asserts subject is null
isNumber
- isNumber(subject): asserts subject is number
Returns asserts subject is number
isString
- isString(subject): asserts subject is string
Returns asserts subject is string
isTrue
- isTrue(subject): asserts subject is true
Returns asserts subject is true
isUndefined
- isUndefined(subject): asserts subject is undefined
Returns asserts subject is undefined
noBoolean
- noBoolean<S>(subject): void
Parameters
- subject: Exclude<S, boolean>
Returns void
noError
- noError<S>(subject): void
Parameters
- subject: Exclude<S, Error>
Returns void
noFalse
- noFalse<S>(subject): void
Parameters
- subject: Exclude<S, false>
Returns void
noFunction
- noFunction<S>(subject): void
Returns void
noNull
- noNull<S>(subject): void
Parameters
- subject: Exclude<S, null>
Returns void
noNumber
- noNumber<S>(subject): void
Parameters
- subject: Exclude<S, number>
Returns void
noString
- noString<S>(subject): void
Parameters
- subject: Exclude<S, string>
Returns void
noTrue
- noTrue<S>(subject): void
Parameters
- subject: Exclude<S, true>
Returns void
noUndefined
- noUndefined<S>(subject): void
Parameters
- subject: Exclude<S, undefined>
Returns void
💥 immediate 🚦 assertion
Assert the subject satisfies the specified type T