Created
October 9, 2022 11:25
-
-
Save semlinker/d7cb55bd134a4039d33e73a63aba2581 to your computer and use it in GitHub Desktop.
From T, pick a set of properties whose type are not assignable to U.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type OmitByType<T, U> = { | |
[P in keyof T as T[P] extends U ? never : P]: T[P] | |
} | |
type OmitBoolean = OmitByType<{ | |
name: string | |
count: number | |
isReadonly: boolean | |
isEnable: boolean | |
}, boolean> // { name: string; count: number } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment