0.0.3 • Published 5 years ago
typescript-essentials v0.0.3
Typescript Essentials
Must-have utility types and functions for TypeScript
Overview
This is a small util library which contains several types and functions that may be useful in your TypeScript project.
Getting started 🌩
npm
npm install typescript-essentialsyarn
yarn add typescript-essentialsContents
Predicates & type guards
Useful to compose simple predicates, or to narrow types in arrays or other data structures.
PredicateandTypeGuardinterfacesnot()function to negate predicatesisNull()type guardisUndefined()type guardisNullOrUndefined()type guardisNotNull()type guardisNotUndefined()type guardisNotNullOrUndefined()type guardmatchesDiscriminator()function that returns a type guard
Ordered
Ordered<T>interfacecompareByOrder()comparator function
Generics
DiscriminatedUnionto narrow a union type using a discriminator fieldWithPartialto make certain properties optionalNarrowableto identify a type that can be narrowed
Array utils
uniqueValues()exclude()partition()
Object utils
omitfunction (to omit specific properties from objects)
Angular utils
trackByIndex,trackByIdandcreateTrackByFnfunctions
Contributors ✨
Thanks goes to these wonderful people (emoji key):
This project follows the all-contributors specification. Contributions of any kind welcome!