Skip to content

Related error span for "did you mean ...?" error messages #25031

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 an error when accessing declarations that have been misspelled.

Property '{0}' does not exist on type '{1}'. Did you mean '{2}'?
Cannot find name '{0}'. Did you mean '{1}'?
Object literal may only specify known properties, but '{0}' does not exist in type '{1}'. Did you mean to write '{2}'?
Cannot find name '{0}'. Did you mean the static member '{1}.{0}'?
Cannot find name '{0}'. Did you mean the instance member 'this.{0}'?
Module '{0}' has no exported member '{1}'. Did you mean '{2}'?

We can add a related span on the declaration of the suggestion if one exists:

It's likely that you meant to reference '{0}'.

This can help users quickly glance at the original declaration.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScriptDomain: Related Error SpansSpecifying regions for error messages/diagnostics on multiple locations.FixedA PR has been merged for this issue

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions