Skip to content

Instantly share code, notes, and snippets.

@bjornstar
Created October 25, 2022 10:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bjornstar/51f8b76abda35f2ab13a111a846d3ef7 to your computer and use it in GitHub Desktop.
Save bjornstar/51f8b76abda35f2ab13a111a846d3ef7 to your computer and use it in GitHub Desktop.
JSDoc Typescript Has Property
/**
* @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