mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
15 lines
464 B
TypeScript
15 lines
464 B
TypeScript
// @noEmit: true
|
|
|
|
// https://github.com/microsoft/TypeScript/issues/63269
|
|
|
|
export type Prepend<Elm, T extends unknown[]> =
|
|
T extends unknown ?
|
|
((arg: Elm, ...rest: T) => void) extends ((...args: infer T2) => void) ? T2 :
|
|
never :
|
|
never;
|
|
export type ExactExtract<T, U> = (T extends U ? U extends T ? T : never : never) & string;
|
|
type Conv<T, U = T> = {
|
|
0: [T];
|
|
1: Prepend<T, Conv<ExactExtract<U, T>, {a: number}>>;
|
|
}[U extends T ? 0 : 1];
|