Object#hasOwnProperty
and Object.hasOwn
are overly restrictive
#13
Labels
bug
Something isn't working
Object#hasOwnProperty
and Object.hasOwn
are overly restrictive
#13
In #4 it was suggested to improve the typing to
this is this & Record<Key, unknown>
but b864600 seems to have set it to something closer tothis is {}
instead. As a result, none of the properties can queried or assigned to. For example:gives error
Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'. No index signature with a parameter of type 'string' was found on type '{}'.
(withnoImplicitAny
enabled). The example is a bit contrived, but this kind of loop is very common in older code where prototypes can't be trusted.Was the intent to implement something like the intersection suggested in #4? I modified
Object.hasOwn
locally as follows:The text was updated successfully, but these errors were encountered: