ts-advanced-types
v1.1.2
Published
Advanced types and utility functions for TypeScript.
Downloads
202
Maintainers
Readme
TypeScript Advanced Types
Advanced types and utility functions for TypeScript.
Usage
$ npm install --save ts-advanced-types
See index.ts for full reference.
Utility types
Without<T, U>
Remove all properties from T that are assignable to UTypeXOR<T, U>
XOR of two types
Basic types
Falsy
JavaScript falsy typesPrimitiveValidIndexSignature
JavaScript primitive types accepted as index signaturesPrimitive
JavaScript primitive non-falsy typesComplex
JavaScript non-falsy typesFalsyOrLiteral
JavaScript primitive types, including falsy valuesDocument<T = Complex>
An object made of string keys and non-falsy values. To add new types to values, use theT
type parameter.JsonOrString
A JSON, as a string or as a parsed object or array
Advanced types/classes
TreeItem<T>
A generic treeEmptyConstructorOf<T>
A type that implements a constructor without argumentsClonableType<T>
A type that is clonable: it can be instantiated with a partial object
Utility functions
isFalsyOrSpaces(value)
Check if a value is falsy or a string with only spaces, ignoring number 0withoutProps(obj, ...props)
Clones an object, optionally removing a list of propertiesequals(a, b)
Checks if two objects are equal using theequals
method or strict equalitygetMethods(obj)
List all methods of an object and its prototypes