@24vlh/ts-assert
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

Typescript assertions

Lightweight typescript type assertion library.

Installation

npm i --save @24vlh/ts-assert

Usage

import {OfArrayType} from '@24vlh/ts-assert/array';

const array = ['a', 'b', 'c'];

if (OfArrayType<string>(array)) {
    // do something with the array
}

List of helpers

Types

  • TypeofValues
  • ObjectTypeValues

Helpers

  • ReturnConstructor

Assertion helpers

  • OfArrayType
  • ArrayOfGivenTypeClass
  • ArrayOfGivenTypePrimitive
  • OfBooleanType
  • OfBooleanTypeAsString
  • EmptyArray
  • EmptyObject
  • EmptyString
  • OfFalseType
  • OfFalseTypeAsString
  • OfFloatType
  • OfFunctionType
  • 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

Readme

Keywords

Package Sidebar

Install

npm i @24vlh/ts-assert

Weekly Downloads

12

Version

1.0.9

License

Apache-2.0

Unpacked Size

428 kB

Total Files

401

Last publish

Collaborators

  • 24vlh