svgdotjs / svg.js

The lightweight library for manipulating and animating SVG
https://svgjs.dev
Other
11.01k stars 1.07k forks source link

Type errors #1203

Closed crystalfp closed 3 years ago

crystalfp commented 3 years ago

Bug report

Typescript, inside Visual Studio Core, complains for two errors inside svg.js.d.ts (3.1.0 version):

node_modules/@svgdotjs/svg.js/svg.js.d.ts(824,28): error TS7051: Parameter has a name but no type. Did you mean 'arg0: any'?
node_modules/@svgdotjs/svg.js/svg.js.d.ts(1107,9): error TS7010: 'zoom', which lacks return-type annotation, implicitly has an 'any' return type.

Fiddle

It is a typescript compilation error and the error is clearly explained in the above error messages.

Explanation

I expect no compilation errors. Well, there are many other error messages from my code, seems from disruptive changes from the previous svgjs version, but I have to investigate them.

Fuzzyma commented 3 years ago

Feel free to create a PR that we can merge. You can even edit the files directly in your browser :)

crystalfp commented 3 years ago

In file svg.js.d.ts line 824 add parameter name:

type EasingCallback = (...args: any) => number

In file svg.js.d.ts line 1107 add return type:

zoom(level: NumberAlias, point?: Point): this
Fuzzyma commented 3 years ago

Thanks to @maximedupre who helped out with this. Its merged!

crystalfp commented 3 years ago

Everything solved with the last update! Thanks!