ts-advanced-types
v1.2.0
Published
Advanced types and utility functions for TypeScript.
Maintainers
Readme
TypeScript Advanced Types
Advanced types and utility functions for TypeScript.
Usage
$ npm install --save ts-advanced-typesSee 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
FalsyJavaScript falsy typesPrimitiveValidIndexSignatureJavaScript primitive types accepted as index signaturesPrimitiveJavaScript primitive non-falsy typesComplexJavaScript non-falsy typesFalsyOrLiteralJavaScript primitive types, including falsy valuesDocument<T = Complex>An object made of string keys and non-falsy values. To add new types to values, use theTtype parameter.JsonOrStringA 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 theequalsmethod or strict equalitygetMethods(obj)List all methods of an object and its prototypes
