I'm trying to create a Path2D object from an SVG string path. According to the Path 2D documentation from Mozilla, it's possible to pass a string path as the parameter, however, when I try it in my code, the Webstorm IDE show me this error:
TS2345: Argument of type "" is not assignable to parameter of type 'Path2D'
The code I'm trying to execute is:
let p = new Path2D('M10 10 h 80 v 80 h -80 Z');
I've found out that the lib.d.ts, where the Path2D is declared, does not have a string constructor for the Path2D class.
How can I solve this problem? I'm using Typescript 2.2.1