Svg.js: Correct typings for svg.js 3.0

Created on 19 Oct 2018  路  14Comments  路  Source: svgdotjs/svg.js

There are coming major breaking changes with the release of svg.js v3.0. To satisfy the TypeScript community we have to update the typings.

  • take a look into the CHANGELOG.md to see what changed
  • update the typings in the d.ts file

You will notice that the typings may be incomplete at some places. Feel free to fill the gaps. Especially the fx module and transformations need an update.

Every bit counts! We take what we can get :).

Note: Make sure to work on the 3.0 branch
For any questions head over to our gitter chat!

Hacktoberfest help wanted

Most helpful comment

svg,js @version 2.6.3
var draw = SVG('drawing').size(300, 130)

var line = draw.line(0, 100, 100, 0).move(20, 20)
line.stroke({ color: '#f06', width: 10, linecap: 'round' })
var wellName = "s224";

draw line!

svg,js @version 3.0.5

TypeError: SVG(...) is null

Error Why?

All 14 comments

Would like to take this up.

Just to understand, is there also a existing tests.ts file to check the existing type definitions?
If not, I would be happy to add that. If you would like to evaluate the option, this might be useful. (https://github.com/DefinitelyTyped/DefinitelyTyped#create-a-new-package)

No we don't have such a file. But that sounds great. Tests are always welcome - for everything! How does such a testfile look like? Do you just list example code for every method in the lib?

Yes, that's mostly what you have to do. It looks something like this :
https://github.com/bendtherules/tree-model-js/blob/master/types/tree-model-tests.ts

It will ensure that if this test code is valid (it is never run), then the typedef is correct. But it's upto us to ensure that this test file shows correct usage of the library.

One more file to maintain :D. But I think its worth it. Go ahead! :)

@bendtherules just to make sure: It doesnt matter if its not complete. Do what you can!

@bendtherules whats your progress with this?

We might need help here 馃槃

Sorry, no progress here.

svg,js @version 2.6.3
var draw = SVG('drawing').size(300, 130)

var line = draw.line(0, 100, 100, 0).move(20, 20)
line.stroke({ color: '#f06', width: 10, linecap: 'round' })
var wellName = "s224";

draw line!

svg,js @version 3.0.5

TypeError: SVG(...) is null

Error Why?

I need @Version 3.0.5 because draw.clear() worked right.

sorry for speak

The typings are not up to date for 3.0.5. If you know how to fix it, feel free to do so. No Maintainer has enough knowledge to do so, so we depend on the community

@version 3.0.12 not work text click and draggable but before in @version 2.7.0 - all be fine

im novice, try to use your great library! sorry for my donk questions. i want to create realtime monitoring system with your library https://hydrofalll.ddns.net/free/ but memory leak, maybe who may help me to tell , what i do wrong and where my big trouble, sorry just my hands pull down....

Was this page helpful?
0 / 5 - 0 ratings