11 results for constructors
develwoutacause’s Twitter Archive—№ 1,702
reproducing outside of CE, but I can't manually invoke the constructor of a class. > class Foo { prop; } > Foo.apply({ prop: 'test' }); TypeError: Class constructor Foo cannot
develwoutacause’s Twitter Archive—№ 1,207
@JemYoung Constructors should *never* have side effects or non-trivial computations. Constructors are for constructing, and assigning parameters to fields. If you want to do more, wrap it in a factory.
develwoutacause’s Twitter Archive—№ 1,640
= document.createElement('foo-bar'); el.prop = 'test'; customElements.define('foo-bar', class extends HTMLElement { constructor() { super(); console.log(this.prop); // undefined } });
develwoutacause’s Twitter Archive—№ 436
Particularly interested in abstract constructors as they relate to some upcoming content I'm excited to share... https://twitter.com/typescript/status/1349158343240163328. @typescript/1349158343240163328.
develwoutacause’s Twitter Archive—№ 445
solution, but if you're using TypeScript, could you erase the constructor from the public type? I've used that trick to hide implementation details before. I think that would have some