Closed
Description
TypeScript Version: 2.1.5
Code
class A<T> { a: T }
type M<T> = {[P in keyof T]: A<T[P]>}
function foo<T>(m: (t: T) => M<T>, t: T) {
let x: {[P in keyof T]: A<T[P]> } = m(t);
}
Expected behavior:
Should compile.
Actual behavior:
Fails to compile at the initialization of x
with the claim the types were incompatible:
app.ts(200,9): error TS2322: Type 'M<T>' is not assignable to type '{ [P in keyof T]: A<T[P]>; }'.
Type 'A<T[P]>' is not assignable to type 'A<T[P]>'. Two different types with this name exist, but they are unrelated.
Type 'T[P]' is not assignable to type 'T[P]'. Two different types with this name exist, but they are unrelated.
(Maybe this is the expected behavior for some reason, but it seems off to me.)
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
ahejlsberg commentedon Mar 12, 2017
Duplicated of #12832. Already fixed in #13448.