antvis/G6

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

  1. Hover over data in line 9 to see error.
  2. 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


This issue has been closed because it has been outdate for a long time. Please open a new issue if you still need help.

这个 issue 已经被关闭,因为 它已经过期很久了。 如果你仍然需要帮助,请创建一个新的 issue。

posted by github-actions[bot] about 1 year ago

Fund this Issue

$0.00
Funded

Pull requests