piotrwitek /utility-types
Collection of utility types, complementing TypeScript built-in mapped types and aliases (think "lodash" for static types).
★ 5,768⑂ 236👁 30⑃ 95● 120▤ 17
-1
日增长
5,768
stars
236
forks
30
watchers
95
prs
120
issues
17
releases
README
utility-types Collection of utility types, complementing TypeScript built-in mapped types and aliases (think "lodash" for static types). _Found it useful? Want more updates?_ Show your support by giving a :star: What's new? :tada: _Added new utilities_ :tada: Features Providing a set of Common Types for TypeScript projects that are idiomatic and complementary to existing TypeScript Mapped Types so you don't need to copy them between the projects. Providing a set of Additional Types compatible with Flow's Utility Types to allow much easier migration to TypeScript. Goals Quality - thoroughly tested for type correctness with type-testing library dts-jest Secure and minimal - no third-party dependencies No runtime cost - it's type-level only Installation bash NPM npm install utility-types YARN yarn add utility-types Compatibility Notes TypeScript support v3.x.x - TypeScript v3.1+ v2.x.x - TypeScript v2.8.1+ v1.x.x - TypeScript v2.7.2+ Funding Issues Utility-Types is an open-source project created by people investing their time for the benefit of our community. Issues like bug fixes or feature requests can be very quickly resolved when funded through the IssueHunt platform. I highly recommend adding a bounty to the issue that you're waiting for to attract some contributors willing to work on it. Contributing We are open for contributions. If you're planning to contribute please make sure to read the contributing guide as it can save you from wasting your time: CONTRIBUTING.md --- _(built-in)_ - types built-in TypeScript, no need to import Table of Contents Aliases & Type Guards Primitive isPrimitive Falsy isFalsy Nullish isNullish Union operators SetIntersection SetDifference SetComplement SymmetricDifference Exclude _(built-in)_ Extract _(built-in)_ NonNullable _(built-in)_ NonUndefined Object operators FunctionKeys NonFunctionKeys MutableKeys ReadonlyKeys RequiredKeys OptionalKeys UnionKeys Optional Partial _(built-in)_ DeepPartial Required DeepRequired Readonly _(built-in)_ DeepReadonly Mutable Pick _(built-in)_ Omit _(built-in)_ PickByValue PickByValueExact OmitByValue OmitByValueExact Intersection Diff Subtract Overwrite Assign ValuesType Special operators ReturnType _(built-in)_ InstanceType _(built-in)_ PromiseType Unionize Brand UnionToIntersection Flow's Utility Types $Keys $Values $ReadOnly $Diff $PropertyType $ElementType $Call $Shape $NonMaybeType Class mixed Deprecated API (use at own risk) getReturnOfExpression() - from TS v2.0 it's better to use type-level ReturnType instead --- Primitive Type representing primitive types in JavaScript, and thus TypeScript: string | number | bigint | boolean | symbol | null | undefined You can test for singular of these types with typeof isPrimitive This is a TypeScript Typeguard for the Primitive type. This can be useful to control the type of a par
Top issues
#30Add a web page with API documentation that will be automatically generated from the recent source code changes34 comments · 2018-09-19#18$ObjMap support14 comments · 2018-04-03#141docs: how to use utility-types in deno6 comments · 2020-05-31#145`DeepReadonly` doesn't handle arrays properly5 comments · 2020-06-19#205NullableProps3 comments · 2025-10-20#144DeepReadonly should allow circular references in TS 3.94 comments · 2020-06-04#137XOR4 comments · 2020-04-23#115DeepXXX<T> code consistency4 comments · 2019-10-21
Latest release
v3.11.0 v3.11.0 2024-01-18What's Changed
Fix a typo in README by @gamtiq in https://github.com/piotrwitek/utility-types/pull/153
add "Nullish" type alias by @zhirzh in https://github.com/piotrwitek/utility-types/pull/152
Fix typo in $Call documentation by @kumar303 in https://github.com/piotrwitek/utility-types/pull/154
Link to ReturnType from $Call docs by @kumar303 in https://github.com/piotrwitek/utility-types/pull/155
fix: ReadOnly has a typo in its documentation (156) by @cyli2014 in https://github.com/piotrwitek/utility-types/pull/157
fix: DeepPartial with generic parameter should allow assigning {} b