Why do f and j pass type-checking? Is it possible to configure TypeScript so that h passes type-checking but f and j fail? Answer Object.create is designed to return any by Typescript. There has been an issue in Typescript’s Github repository but it’s closed and they do not intend to change it soon.
Tag: prototype-chain
Why is mutating the [[prototype]] of an object bad for performance?
From the MDN docs for the standard setPrototypeOf function as well as the non-standard __proto__ property: Mutating the [[Prototype]] of an object, no matter how this is accomplished, is strongly discouraged, because it is very slow and unavoidably slows down subsequent execution in modern JavaScript implementations. Using Function.prototype to add properties is the way to add member functions to javascript