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

Mapped types intersections are too eagerly resolved #17456

Closed
gcnew opened this issue Jul 27, 2017 · 1 comment
Closed

Mapped types intersections are too eagerly resolved #17456

gcnew opened this issue Jul 27, 2017 · 1 comment
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@gcnew
Copy link
Contributor

gcnew commented Jul 27, 2017

TypeScript Version: nightly (2.5.0-dev.20170727)

Code

type StringContains<S extends string, L extends string> = (
    { [K in S]:      'true' } &
    { [key: string]: 'false' }
  )[L]

type ObjectHasKey<O, L extends string> = StringContains<keyof O, L>

type First<T> = ObjectHasKey<T, '0'> // eagerly resolved as 'false'

Expected behavior:
Type First should be left as an indexing operation.

PS: origin of the issue: gcanti/typelevel-ts#8

@SimonMeskens
Copy link

@ahejlsberg Could you have a look at this one too?

@DanielRosenwasser DanielRosenwasser added the Bug A bug in TypeScript label Jul 27, 2017
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 2.5 milestone Jul 27, 2017
@ahejlsberg ahejlsberg added the Fixed A PR has been merged for this issue label Jul 31, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 14, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants