Skip to content

Conversation

@Zzzen
Copy link
Contributor

@Zzzen Zzzen commented Aug 7, 2021

Fixes #45333

@typescript-bot typescript-bot added the For Backlog Bug PRs that fix a backlog bug label Aug 7, 2021
~~~
!!! error TS2694: Namespace 'Color' has no exported member 'Red'.
~~~~~~~~
!!! error TS2713: Cannot access 'Red.toString' because 'Red' is a type, but not a namespace. Did you mean to retrieve the type of the property 'toString' in 'Red' with 'Red["toString"]'?
Copy link
Member

Choose a reason for hiding this comment

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

I think we'd really like to suggest typeof Color.Red.toString first if that would be valid, then fall back to using indexed access syntax.

Copy link
Member

@andrewbranch andrewbranch left a comment

Choose a reason for hiding this comment

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

Wow, what an improvement 🌟

Copy link
Member

@DanielRosenwasser DanielRosenwasser left a comment

Choose a reason for hiding this comment

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

Looks great except for minor changes I'd like to see before merging.

error(right, Diagnostics._0_has_no_exported_member_named_1_Did_you_mean_2, namespaceName, declarationName, symbolToString(suggestionForNonexistentModule));
}
else if (canSuggestTypeof) {
error(name, Diagnostics._0_refers_to_a_value_but_is_being_used_as_a_type_here_Did_you_mean_typeof_0, entityNameToString(fullQualifiedName as QualifiedName));
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Haven't tried TypeScript 4.4, so I wrote fullQualifiedName as QualifiedName. After upgrading vscode, I find it is unnecessary. The CFA is really impressive, kudos to you guys!

Copy link
Member

@DanielRosenwasser DanielRosenwasser left a comment

Choose a reason for hiding this comment

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

What an improvement - thank you!

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

Labels

For Backlog Bug PRs that fix a backlog bug

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

Namespace.Interface.prop gives wrong error message

4 participants