Object: Pick by type

Medium
object
conditional types
mapped types
key remapping

Description:

From T, pick a set of properties whose type are assignable to U.

For example:

type Model = { name: string; count: number; isReadonly: boolean; isEnable: boolean }; type OnlyBoolean = PickByType<Model, boolean> // { isReadonly: boolean; isEnable: boolean; }

Code

Loading...