17 Matching Annotations
- Nov 2021
-
-
export type Simplify<T> = {[KeyType in keyof T]: T[KeyType]};
-
- Oct 2021
-
-
function applyDefaults(fetchFn: typeof fetch, defaults: Required<Parameters<typeof fetch>[1]>)
-
In rare cases, the underlying types aren't exposed from the library. What shall we do then? Maybe we could also use the typeof operator here too and combine it with a TypeScript's built-in type Parameters. Parameters becomes useful whenever you want to extract the type of parameters from a function type:
-
- Nov 2019
-
www.typescriptlang.org www.typescriptlang.org
- Oct 2019
-
github.com github.com
-
// Partial: [P in keyof T], could be read as a function T => [P in keyof T] // Pick: [P in K], could be read as a function K => [P in K]
-
-
-
"Fix" is to use Pick2: type Pick2<T> = T extends T ? Pick<T> : never
-
-
stackoverflow.com stackoverflow.com
-
type KeysOfType<A extends object, B extends { [key: string]: any }> = { [K in keyof A]: A[K] extends B ? string extends keyof A[K] ? K : never : never; }[keyof A];
-
type KeysOfType<A extends object, B> = { [K in keyof A]-?: A[K] extends B ? K : never; }[keyof A];
-
-
github.com github.com
-
github.com github.com
-
stackoverflow.com stackoverflow.com
-
type TagWithKey<TagName extends string, T> = { [K in keyof T]: { [_ in TagName]: K } & T[K] };
-
type Unionize<T> = T[keyof T]; type MyActions = Unionize<ActionTable>;
-
-
www.typescriptlang.org www.typescriptlang.org
-
Exclude<string | number | (() => void), Function>
-
type Unpacked<T>
-
-
github.com github.com