Message from JavaScript discussions

September 2020

— And runtime type checking for dynamic getters

— 

Such as

type WithADiv = HTMLElement & {
children(): applies _.filter(n => n instanceof HTMLDivElement).length === 1
}

or something

— Djeezuz

— Compiling to checks for the thing

— Krust

— 

const e = document.createElement('span');
e.appendChild(document.createElement('div'));
const we = e as WithADiv;

into
const e = document.createElement('span');
e.appendChild(document.createElement('div'));
if (!(e.children.filter(n => n instanceof HTMLDivElement).length === 1))
throw new TSError('or something');
const we = e;

Message permanent page

— That'd be cool

— Wrapping block-level element into inline-level element not cool, but that's only a top of an iceberg i suppose

Message permanent page

— Wat

— Actually in the newer versions of TS you can do these things

— Development versions

— This doesn't exist though