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

extends clause leaks temporary type #31099

Closed
SimonMeskens opened this issue Apr 24, 2019 · 0 comments · Fixed by #31137
Closed

extends clause leaks temporary type #31099

SimonMeskens opened this issue Apr 24, 2019 · 0 comments · Fixed by #31137
Assignees
Labels
Bug A bug in TypeScript Domain: Type Inference Related to type inference performed during signature resolution or `infer` type resolution Fixed A PR has been merged for this issue

Comments

@SimonMeskens
Copy link

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

@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Domain: Type Inference Related to type inference performed during signature resolution or `infer` type resolution labels Apr 25, 2019
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 3.5.0 milestone Apr 25, 2019
@ahejlsberg ahejlsberg added the Fixed A PR has been merged for this issue label Apr 27, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Type Inference Related to type inference performed during signature resolution or `infer` type resolution Fixed A PR has been merged for this issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants