Created
October 25, 2022 10:02
-
-
Save bjornstar/51f8b76abda35f2ab13a111a846d3ef7 to your computer and use it in GitHub Desktop.
JSDoc Typescript Has Property
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
/** | |
* @template {{}} O | |
* @template {PropertyKey} K | |
* @param {O} obj | |
* @param {K} key | |
* @returns {o is O & Record<K, unknown>} | |
*/ | |
function has(obj, key) { | |
return Object.hasOwnProperty.call(obj, key); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment