Object construction with __proto__
such as
let foo = { __proto__: null }
let bar = { __proto__: Bar.prototype, abc: 123 }
is perfectly standardized and safe, unlike the unsafe and legacy Object.prototype.__proto__
getter and setter methods.
The above code is equivalent to
let foo = Object.create(null);
let bar = { abc: 123 }
Object.setPrototypeOf(bar, Bar.prototype)
but faster[citation needed] and much more ergonomic.
Unfortunately, TypeScript does not currently understand this pattern so any uses of it must be @ts-ignore
d, preferably with a link to this gist or the relevant TypeScript issue.