Microsoft/TypeScript

Related error spans for derived members in interfaces/classes

Open

#25,033 创建于 2018年6月18日

在 GitHub 查看
 (0 评论) (0 反应) (0 负责人)TypeScript (48,455 star) (6,726 fork)batch import
Domain: Related Error SpansExperience EnhancementHelp WantedSuggestion

描述

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

  • 0 is the derived type
  • 1 is the member name

and this gets reported on the base type member.

贡献者指南