-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Argument inference change in 3.4.4 #31297
Copy link
Copy link
Closed
Labels
Domain: check: Type InferenceRelated to type inference performed during signature resolution or `infer` type resolutionRelated to type inference performed during signature resolution or `infer` type resolutionWorking as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
Milestone
Metadata
Metadata
Assignees
Labels
Domain: check: Type InferenceRelated to type inference performed during signature resolution or `infer` type resolutionRelated to type inference performed during signature resolution or `infer` type resolutionWorking as IntendedThe behavior described is the intended behavior; this is not a bugThe behavior described is the intended behavior; this is not a bug
TypeScript Version: 3.4.4-dev.20190507
Search Terms: 3.4.4 generic argument inference
Code
Expected behavior:
Expected to compile without any errors, with the type of
selfinferred as{ val: number, func(): number }. This works as expected from v3.1 -> 3.4.3Actual behavior:
As of 3.4.4 this no longer works. Looks like
selfis being inferred as{}. TypeScript emits the following error atreturn self.val:I tested this with TypeScript@3.5.0-dev.20190507 and it looks like
selfis being inferred asunknown. It emits the following error:Playground Link:
works in older version of TypeScript