antvis/G6

The issue has been closed
Main `G6` and `Algorithm` are using different type declarations for `GraphData` + `_index.default is not a constructor` #3604
sklinov posted onGitHub
Describe the bug
It appears that GraphData
interface imported from @antv/g6
and the one in Algorithm
have conflicts with each other.
That resolves into errors when trying to pass well working data to findAllPathsAsync
for example
Argument of type 'import("/Users/.../node_modules/@antv/g6-core/lib/types/index").GraphData' is not assignable to parameter of type 'import("/Users/.../node_modules/@antv/algorithm/lib/types").GraphData'.
Types of property 'edges' are incompatible.
Type 'import("/Users/.../node_modules/@antv/g6-core/lib/types/index").EdgeConfig[] | undefined' is not assignable to type 'import("/Users/.../node_modules/@antv/algorithm/lib/types").EdgeConfig[] | undefined'.
Type 'import("/Users/.../node_modules/@antv/g6-core/lib/types/index").EdgeConfig[]' is not assignable to type 'import("/Users/.../node_modules/@antv/algorithm/lib/types").EdgeConfig[]'.
Type 'import("/Users/.../node_modules/@antv/g6-core/lib/types/index").EdgeConfig' is not assignable to type 'import("/Users/.../node_modules/@antv/algorithm/lib/types").EdgeConfig'.
Types of property 'source' are incompatible.
Type 'string | undefined' is not assignable to type 'string'.
Type 'undefined' is not assignable to type 'string'.
Another issue is
_index.default is not a constructor
Your Example Website or App
https://codesandbox.io/s/g6-algorithm-types-9bsuxw
Steps to Reproduce the Bug or Issue
- Hover over
data
in line 9 to see error. - Check out the error in codesandbox
Expected behavior
- I expect different parts of
G6
library to use the same type declarations all across the different packages. - I expect
_index.default is not a constructor
not to be thrown.
Screenshots or Videos
No response
Platform
- OS: MacOS
- Browser: Chrome
- Version: 99
Additional context
In my production project I'm on v4.5.2
of @antv/g6
, I see that type declarations are a bit different when migrating from 4.5.2
-> 4.6.4
but the error is the same