Skip to content

When --noImplicitAny is enabled, don't report errors suggesting that a 'void' function can be 'new'ed #26579

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
1 commit merged into from
Aug 21, 2018

Conversation

ghost
Copy link

@ghost ghost commented Aug 21, 2018

Previously, on this code:

function f(this: void): number { return 0; }
new f();

With --noImplicitAny there were 3 errors: The first saying the return type should be void, the second saying it can't have a this type, and the third saying it must have a construct signature. The first and second errors are misleading because neither of those will fix the problem -- with --noImplicitAny void functions are not new-able.

@ghost ghost merged commit 7288651 into master Aug 21, 2018
@ghost ghost deleted the newOperatorErrorCases_noImplicitAny branch August 21, 2018 17:02
mheiber pushed a commit to mheiber/TypeScript that referenced this pull request Aug 23, 2018
mheiber pushed a commit to mheiber/TypeScript that referenced this pull request Aug 23, 2018
joeywatts pushed a commit to joeywatts/TypeScript that referenced this pull request Sep 25, 2018
This pull request was closed.
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.

1 participant