Skip to content

Generic defaults implicit any - #14396

Closed
Ron Buckton (rbuckton) wants to merge 7 commits into
masterfrom
genericDefaultsImplicitAny
Closed

Ron Buckton (rbuckton) wants to merge 7 commits into
masterfrom
genericDefaultsImplicitAny

Conversation

@rbuckton

Copy link
Copy Markdown
Contributor

This changes the behavior for unsupplied type arguments in a type reference from the current behavior where we infer {}, to instead infer an implicit any. As a result, providing too few type arguments in a type reference will no longer report an error unless the noImplicitAny compiler option is set.

Fixes #13609

!!! error TS2707: Type parameter 'T2' implicitly has type 'any' because it was not supplied.
constructor() { super(value => String(value)); }
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2346: Supplied parameters do not match any signature of call target.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This seems wrong. we already set T1 and T2 to any, so this should resolve with no errors, the noImplicitAny on the extends clause should be sufficient.

@mhegazy
Mohamed Hegazy (mhegazy) deleted the genericDefaultsImplicitAny branch November 2, 2017 21:00
@microsoft Microsoft (microsoft) locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants