I have a basic Stencil app built with Typescript. I'm not using Angular. I'm unable to use svg.js.
Here is my full Component:
import { Component, State } from '@stencil/core';
import * as moment from 'moment';
import * as SVG from 'svg.js';
@Component({
tag: 'astro-sandbox',
styleUrl: 'sandbox.css'
})
export class AstroSandbox {
componentDidLoad() {
// console.info(SVG)
let drawing = SVG('drawing');
}
render() {
return (
<div>
<div id="drawing">
</div>
</div>
);
}
}
This fails with { Error: Cannot call a namespace ('SVG')...
I tried looking at SVG with console.info('SVG')
and it compiles but the browser gives me the error
TypeError: Cannot set property 'SVG' of undefined
.
I know that my app works and I got moment.js working no problem, so there's not a TS config issue. Intellisense for svg.js in VS Code is also working.