Skip to content

Commit

Permalink
chore: setup PoC for all types
Browse files Browse the repository at this point in the history
  • Loading branch information
AshGw committed Apr 18, 2024
1 parent c2d8157 commit efbcb07
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,6 @@ export type Stretch<T> = T extends object
: never
: T;

const _ = Symbol('_');
export type TypeGuard<T> = (_: any) => _ is T;

export type FilterBy<T, P> = {
Expand Down Expand Up @@ -224,3 +223,17 @@ export function final<T extends Newable>(target: T): T {
}
};
}

export type IfSame<T, P, Yes, No> = T extends P ? Yes : No;
export type ShallowEquals<X, Y> = X extends Y ? true : false;
export type Equals<X, Y> = (<T>() => T extends X ? true : false) extends <
T,
>() => T extends Y ? true : false
? true
: false;

export type MutableKeys<T> = keyof {
[P in Keys<T> as Equals<Pick<T, P>, Readonly<Pick<T, P>>> extends true
? never
: P]: never;
};

0 comments on commit efbcb07

Please sign in to comment.