I’m new to TypeScript and JavaScript, although not completely new to programming. I wondered if someone could help me with a short piece of TypeScript code showing how you would use TypeScripts SVG library to draw. So, for example, should I use SVGRectangle or SVGRectangleElement and how do I use them?
The only example I can find on the TypeScript site uses D3 but I would like to use the built in SVG library.
Just to clarify, TypeScript doesn’t have an SVG library – but you can use native JavaScript SVG or one of the SVG libraries in your TypeScript code.
This opens up the samples and tutorials you will find, as you can search for “JavaScript SVG” rather than “TypeScript” SVG.
I recommend the MDN SVG Reference as a starting point.