Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion types/object.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ export type Mapped< Keys extends string, T > = { [ K in Keys ]: T };
*
* @example
* const stringValidator: PartiallyMapped< 'username' | 'email', ( field: string ) => boolean > = {
* username: ( field: string ) => regex.validate( 'username', field )
* username: ( field: string ) => /usernameregex/.test( field )
* };
*/
export type PartiallyMapped< Keys extends string, T > = { [ K in Keys ]?: T };
Expand Down
2 changes: 1 addition & 1 deletion types/union.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ export type UnionHas< U, T > = [ T ] extends [ U ] ? true : false;
* @example
* type A = 'a' | 'b' | 'c';
* type B = 'a' | 'x';
* type C = UnionDifference< A, B >; // 'a'
* type C = UnionIntersect< A, B >; // 'a'
*/
export type UnionIntersect< A, B > = A extends B ? A : never;

Expand Down
4 changes: 2 additions & 2 deletions types/util.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,8 +130,8 @@ export type Flatten< T > = T extends any[] ? { [ K in keyof T ]: T[ K ] } : T;
* @template T - Type to widen
*
* @example
* type A = Narrow< 'hello' >; // string
* type B = Narrow< true >; // boolean
* type A = Widen< 'hello' >; // string
* type B = Widen< true >; // boolean
*/
export type Widen< T > =
T extends string ? string
Expand Down