The cool thing about Typescript is that I have to cast this `Element` that's actually a SVG document to `Unknown` so that I can cast it to `SVGSVGElement` as opposed to `SVGElement` or SVG.js's `Element`... otherwise I won't get any of the functions built-into SVGs...

var newDOM = new DOMParser().parseFromString(svgString, 'image/svg+xml') as unknown as SVGSVGElement;

You see, they call it Typescript because everyone just keeps making new Types all the time, and none of them are strictly compatible with any of the others and won't compile if you do it wrong -- then this all compiles down to Javascript that laughs at your stupid "Types" HAHAHA, they're all objects, idiot.

Sign in to participate in the conversation

masto instance for the tildeverse