-
Notifications
You must be signed in to change notification settings - Fork 13.2k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: check: Type InferenceRelated to type inference performed during signature resolution or `infer` type resolutionRelated to type inference performed during signature resolution or `infer` type resolutionFixedA PR has been merged for this issueA PR has been merged for this issue
Milestone
Description
TypeScript Version: 3.5.0-dev.20190420
Code
// type Weird = U
type Weird = any extends infer U ? U : never;
// Type 'null' is not assignable to type 'U'.
const a: Weird = null;
// Type 'U' is not assignable to type 'string'.
const b: string = a;
// type AlsoWeird = U
type AlsoWeird = unknown extends infer U ? U : never;Expected behavior: Infer some type
Actual behavior: The extends clause leaks a temporary type U. Happens for any and unknown
Playground Link: Playground
uhyo and DanielRosenwasserkeithlayne
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptDomain: check: Type InferenceRelated to type inference performed during signature resolution or `infer` type resolutionRelated to type inference performed during signature resolution or `infer` type resolutionFixedA PR has been merged for this issueA PR has been merged for this issue