Skip to content

Commit

Permalink
Iterate
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy committed Dec 19, 2024
1 parent ae935eb commit d28bf64
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/@types/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,10 @@ export type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
export type XOR<T, U> = T | U extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
export type Writeable<T> = { -readonly [P in keyof T]: T[P] };

// Based on https://stackoverflow.com/a/57862073
/**
* Returns a union type of the keys of the input object type whose values are assignable to the given type.
* Based on https://stackoverflow.com/a/57862073
*/
export type Assignable<Obj, Item> = {
[Key in keyof Obj]: Obj[Key] extends Item ? Key : never;
}[keyof Obj];

0 comments on commit d28bf64

Please sign in to comment.