Replies: 2 comments 1 reply
-
TypeScript Error: setDefaultEdgeLabel Not Found on Graph Type in dagre After Adding @ant-design/charts 问题说明引入
产生原因分析
解决办法1. 检查依赖版本
2. 明确类型声明
// 假设 yourDagreInstance 是 dagre.graphlib.Graph 的实例
(yourDagreInstance as any).setDefaultEdgeLabel(() => ({})); 3. 明确引入的 Graph 类型
import dagre from 'dagre';
// 最保险的:确保是 dagre 的 graphlib.Graph
const g = new dagre.graphlib.Graph();
g.setDefaultEdgeLabel(() => ({})); // 不报错 4. 覆盖 package 依赖或 alias
5. 避免使用全局
|
Beta Was this translation helpful? Give feedback.
0 replies
-
@yvonneyx 瞧一瞧。 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
After adding @ant-design/charts to our project, we're encountering TypeScript errors with previously working dagre graph operations. Specifically, the setDefaultEdgeLabel() method now throws:
Property 'setDefaultEdgeLabel' does not exist on type 'Graph<unknown, unknown>'. ts(2339)
This error occurs despite dagre functioning correctly before the addition of @ant-design/charts.

Beta Was this translation helpful? Give feedback.
All reactions