Skip to content

Latest commit

 

History

History
31 lines (29 loc) · 743 Bytes

es2022.object.d.ts.md

File metadata and controls

31 lines (29 loc) · 743 Bytes

es2022.object.d.ts Diffs

Index: es2022.object.d.ts
===================================================================
--- es2022.object.d.ts
+++ es2022.object.d.ts
@@ -3,6 +3,20 @@
    * Determines whether an object has a property with the specified name.
    * @param o An object.
    * @param v A property name.
    */
-  hasOwn(o: object, v: PropertyKey): boolean;
+  hasOwn<Obj extends object, Key extends PropertyKey>(
+    o: Obj,
+    v: Key,
+  ): o is Obj &
+    (string extends Key
+      ? {}
+      : number extends Key
+        ? {}
+        : symbol extends Key
+          ? {}
+          : Key extends PropertyKey
+            ? {
+                [key in Key]: unknown;
+              }
+            : {});
 }