mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
The tests call `.setDefaultEdgeLabel(() => {})` which is a translation
to ES6 of something seen in the example in [Dagre's
readme](https://github.com/cpettitt/dagre/wiki#an-example-layout):
`g.setDefaultEdgeLabel(function() { return {}; });`. However, the
translation is botched: `() => {}` doesn't return an empty object, it
returns `undefined`, because `{}` is not an object literal, it's a
block with 0 statements.
I think this is what motivated the current typing to specify that `void`
can be returned by the callback. However, in my experience returning
`undefined` from this callback causes the library to crash. Thus I've
chagned the tests to say `.setDefaultEdgeLabel(() => ({}))` (i.e.
actually return an empty object, which is what the author probably
intended), and updated the types accordingly. This works in my project.
|
||
|---|---|---|
| .. | ||
| dagre-tests.ts | ||
| index.d.ts | ||
| tsconfig.json | ||
| tslint.json | ||