Skip to content

Commit

Permalink
refactor: rename TuplifyUnion to UnionToTuple
Browse files Browse the repository at this point in the history
  • Loading branch information
RebeccaStevens committed Jan 23, 2025
1 parent 319462a commit 7c2b9d6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/types/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import type {
SimplifyObject,
TransposeTuple,
TupleToIntersection,
TuplifyUnion,
UnionMapKeys,
UnionMapValues,
UnionSetValues,
UnionToTuple,
} from "./utils";

/**
Expand Down Expand Up @@ -51,7 +51,7 @@ export type DeepMergeFunctionsDefaultURIs = Readonly<{
}>;

type RecordEntries<T extends Record<PropertyKey, unknown>> = FilterOut<
TuplifyUnion<
UnionToTuple<
{
[K in keyof T]: [K, T[K]];
}[keyof T]
Expand Down
2 changes: 1 addition & 1 deletion src/types/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ export type TupleToIntersection<T extends ReadonlyArray<unknown>> =
* Warning 2: The union maybe me modified by the TypeScript engine before convertion.
* Warning 3: This implementation relies on a hack/limitation in TypeScript.
*/
export type TuplifyUnion<T, L = LastOf<T>> = IsNever<T> extends true ? [] : [...TuplifyUnion<Exclude<T, L>>, L];
export type UnionToTuple<T, L = LastOf<T>> = IsNever<T> extends true ? [] : [...UnionToTuple<Exclude<T, L>>, L];

type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;

Expand Down

0 comments on commit 7c2b9d6

Please sign in to comment.