microsoft / microsoft/TypeScript

Some SVG types would benefit from stricter appendChild() overloads

Open
#4,178 0 comments 0 reactions 0 assignees View on GitHub
Domain: lib.d.ts Help Wanted Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

``` typescript
interface SVGFEComponentTransferElement {
appendChild(newChild: SVGFEFuncAElement): SVGFEFuncAElement;
appendChild(newChild: SVGFEFuncBElement): SVGFEFuncBElement;
appendChild(newChild: SVGFEFuncGElement): SVGFEFuncGElement;
appendChild(newChild: SVGFEFuncRElement): SVGFEFuncRElement;
appendChild(newChild: Comment): Comment;
}

interface SVGFEMergeElement {
appendChild(newChild: SVGFEMergeNodeElement): SVGFEMergeNodeElement;
appendChild(newChild: Comment): Comment;
}

...
```

to override the generic appendChild(Node) inherited from Node, and so on. This would make it an error to append a `` to a `` for example.

Contributor guide

Open the contributing guide

Research direction

No file or test is named in the issue. Start by locating the SVG DOM declarations and the existing appendChild overload patterns; done means the relevant SVG elements reject invalid child types such as on while accepting their permitted children.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.