2 Matching Annotations
- Aug 2021
-
dev.to dev.to
-
function hasKey<O>(obj: O, key: PropertyKey): key is keyof O { return key in obj }
-
-
stackoverflow.com stackoverflow.com
-
If there is no relationship between the value's type and the type in the type predicate, the guard would make no sense. For example, TypeScript won't allow a user-defined guard like this: function isString(value: Date): value is string { return typeof value === "string"; }
-