Add related error spans for getter/setters with different types #25002
Open
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 a diagnostic for a pair of get
/set
accessor's types not matching:
Code:
let x = {
get foo() { return 100; }
set foo(value: string): { }
}
Current error:
'get' and 'set' accessor must have the same type.
We'd like to give a better error message. For example:
Primary span:
A 'get-' and 'set-' accessor must have the same type, but this 'get' accessor has the type '{0}'.
Related span:
The respective 'set' accessor has the type '{0}'.
Activity