-
Notifications
You must be signed in to change notification settings - Fork 12.5k
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
Improve error on non-ambient class and function merge #32795
Comments
I can work on this one. |
@weswigham here's the error message I've come up with. Any thoughts?
|
At at glance I'd say that looks good, but I'm wondering if the term |
At a glance it's fine to say "ambient" as long as you have something actionable. On the function: Related span on the class: |
@DanielRosenwasser would that look something like this then? Or should the "Function with bodies..." messages only appear when hovering over the function name? |
|
@weswigham sorry, I'm a bit confused as to what "same thing" refers to. Here's my understanding. function Foo(): any;
function Foo(n: number): any {}
// ~~~ Function with bodies can only merge with classes that are ambient.
// No related messages/spans?
class Foo {}
// ~~~ Class declaration cannot implement overload list for '{0}'
// And related "Consider adding 'declare'..." referring to the span of this class? |
The |
In #32584, we're allowing ambient classes and functions to merge, but non-ambient classes and functions still issue the same
Duplicate identifier
error. An improved, more specific, error would be useful. Something mentioning that either the function can have an implementation or both need to be ambient.The text was updated successfully, but these errors were encountered: