Skip to content
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

Declaration emit should avoid issuing errors on unresolved names #58536

Merged

Conversation

weswigham
Copy link
Member

@weswigham weswigham commented May 14, 2024

These already will get errors in the checker when the file is typechecked, so the declaration emitter doesn't need to double up and also error on them.

This basically allows the declaration emitter to copy inputs with unresolvable names into the output without the output being blocked by a declaration-emitter issued error.

Fixes #58496
Fixes #58535

if (false) {
export var myClass = 0;
}
export type MyClass = typeof myClass;
~~~~~~~
!!! error TS4081: Exported type alias 'MyClass' has or is using private name 'myClass'.
Copy link
Member Author

Choose a reason for hiding this comment

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

Declaration emit errors are emitted in the presence of parse errors (unlike checker errors), so this (pretty bogus, given the parse error) error was here before, and now it's gone. If checker errors were reported, there would be one on myClass here, but, again, blocked by a parse error anyway.

@weswigham weswigham merged commit 2d47953 into microsoft:main May 14, 2024
28 checks passed
@weswigham weswigham deleted the declaration-emit-duplicated-errors branch May 14, 2024 19:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Backlog Bug PRs that fix a backlog bug
Projects
None yet
3 participants