Skip to content

Add related span pointing to this-shadowing location for implicitly-any this #28299

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Nov 6, 2018

Conversation

weswigham
Copy link
Member

Fixes #26461

this.m();
~~~~
!!! error TS2683: 'this' implicitly has type 'any' because it does not have a type annotation.
!!! related TS2735 tests/cases/compiler/thisShadowingErrorSpans.ts:4:18: There is a 'this' type shadowed by this container.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As a side note...I think we need better baselines for related information.. Just looking at this baseline first thing I see from message is I don't think message clearly states that its talking about f but then later I saw span. May be it would be good idea to use pretty formatting of related information instead because that's how its going to emerge anyways?

Copy link
Member Author

@weswigham weswigham Nov 2, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you set the pretty flag in the test options, it actually does get recorded like that. I was told that it wasn't typically necessary though, esp. since pretty also has a bunch of formatting characters which don't translate to plaintext well.

@weswigham weswigham merged commit cc36e29 into microsoft:master Nov 6, 2018
@weswigham weswigham deleted the this-scope-errors branch November 6, 2018 19:27
ghost pushed a commit that referenced this pull request Nov 7, 2018
…ny this (#28299)

* Add diagnostic pointing to this-shadowing location

* Fix almost-top-level-this case

* Change message on span
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants