Skip to content

Bad type inference between identical mapped types #18338

Description

@gcnew

TypeScript Version: nightly (2.5.0-dev.20170908)

Code

typeIdMapped<T>={[KinkeyofT]: T[K]}declareconstf: <T>()=>IdMapped<T>;declareconstg: <U>()=>{[KinkeyofU]: U[K]};// Type 'IdMapped<{}>' is not assignable to type '{ [K in keyof T]: T[K]; }'consth: typeofg=f;

Expected behavior:
Should compile without errors. T should be inferred as U.

Metadata

Metadata

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions