Typescript assertions
Lightweight typescript type assertion library.
Installation
``
bash
npm i --save @24vlh/ts-assert
`
Usage
`
ts
import {OfArrayType} from '@24vlh/ts-assert/array';
const array = ['a', 'b', 'c'];
if (OfArrayType(array)) {
// do something with the array
}
``
List of helpers
$3
- TypeofValues
- ObjectTypeValues
$3
- ReturnConstructor
$3
- OfArrayType
- ArrayOfGivenTypeClass
- ArrayOfGivenTypePrimitive
- OfBooleanType
- OfBooleanTypeAsString
- EmptyArray
- EmptyObject
- EmptyString
- OfFalseType
- OfFalseTypeAsString
- OfFloatType
- OfFunctionType
- OfFunctionType2
- OfImmutablePrimitiveType
- InstanceOfType
- OfIntegerType
- OfNanType
- OfNullType
- OfNullTypeAsString
- OfNumberType
- OfNumberTypeAsString
- OfNumericType
- OfObjectType
- ObjectHasOwnProperty
- ObjectHasProperty
- ObjectHasPropertyDeepScan
- ObjectOfType
- OfType
- OfPrimitiveType
- OfPrimitiveTypeAsString
- OfPrimitiveOrBooleanType
- OfPrimitiveOrBooleanTypeAsString
- OfStringType
- OfSymbolType
- OfTrueType
- OfTrueTypeAsString
- OfUndefinedType
- OfUndefinedTypeAsString
@vlah.io