Created
November 30, 2020 04:47
-
-
Save aiya000/e4b876b8f07128396c7e82c0ffcbf246 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
function hasUndefienedPropertyOrThat< | |
PropType, | |
Prop extends string, | |
Base extends { [P in Prop]?: PropType } | |
>(p: (x: PropType | undefined) => x is PropType, x: Base, prop: Prop): boolean { | |
return x[prop] === undefined || p(x[prop]); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment