Tag 加入Group Typescript提示错误
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 3.7k
- Forks
- 486
- Avg merge
- 1d 19h
- Merged PRs (30d)
- 16
Description
const container = createGroup({ height, width, display: "flex", flexDirection: "row", flexWrap: "nowrap", alignItems: "center", }) const tag = new Tag({ text: record.case_pass, textStyle: { fontSize: 10, fontFamily: "sans-serif", fill: "white", }, panel: { visible: true, fill: "#4caf50", }, minWidth: Math.floor((record.case_pass / record.case_total) * width), }) container.add(tag)
使用以上代码在vue3+ typescript中,container.add(tag)中的 tag提示以下问题,要如何解决?
"message": "Argument of type 'Tag' is not assignable to parameter of type 'INode'.\n Types of property 'removeChild' are incompatible.\n Type '(child: IGraphic<Partial<IGraphicAttribute>>) => IGraphic<Partial<IGraphicAttribute>>' is not assignable to type '(node: INode, highPerformance?: boolean | undefined) => INode | null'.\n Types of parameters 'child' and 'node' are incompatible.\n Type 'INode' is missing the following properties from type 'IGraphic<Partial<IGraphicAttribute>>': valid, attribute, toggleState, removeState, and 55 more."
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the shown createGroup and Tag example in a Vue 3 + TypeScript project, then inspect the type definitions for container.add, Tag, and INode. Done means the example type-checks without the reported incompatibility.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100