microsoft / microsoft/TypeScript
Related error spans for derived members in interfaces/classes
Nobody has claimed this yet.
- Dominant language
- Go
- Stars
- 111k
- Forks
- 14.3k
- Avg merge
- 2d 4h
- Merged PRs (30d)
- 132
Description
Now that we support multiple related spans for errors (#10489, #22789, #24548), we'd like to improve an existing error message.
Currently, we provide certain errors for when a derived type incorrectly overrides/implements a member from the base type:
Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member accessor.
Class '{0}' defines instance member function '{1}', but extended class '{2}' defines it as instance member property.
Class '{0}' defines instance member property '{1}', but extended class '{2}' defines it as instance member function.
Class '{0}' defines instance member accessor '{1}', but extended class '{2}' defines it as instance member function.
Property '{0}' in type '{1}' is not assignable to the same property in base type '{2}'.
We can actually provide the base type's member as a related span location for some extra context.
'{0}' redefines '{1}' in an incompatible way.
Where
0is the derived type1is the member name
and this gets reported on the base type member.
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 searching the TypeScript compiler for the existing derived-member and property-assignability diagnostic strings shown in the issue. Trace where those errors are reported and how related spans are attached. Done means using the consolidated message, pointing to the base member as a related span, and preserving the derived type and member name context.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- compilers
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100