TypeScript/tests/baselines/reference/circularContextualMappedType.js
Anders Hejlsberg 7ba0a6592d
No contextual types from circular mapped type properties (#38653)
* No contextual types from circular mapped type properties

* Add regression test
2020-05-19 13:42:30 -07:00

33 lines
590 B
TypeScript

//// [circularContextualMappedType.ts]
type Func<T> = () => T;
type Mapped<T> = { [K in keyof T]: Func<T[K]> };
declare function reproduce(options: number): void;
declare function reproduce<T>(options: Mapped<T>): T
reproduce({
name: () => { return 123 }
});
reproduce({
name() { return 123 }
});
reproduce({
name: function () { return 123 }
});
//// [circularContextualMappedType.js]
"use strict";
reproduce({
name: function () { return 123; }
});
reproduce({
name: function () { return 123; }
});
reproduce({
name: function () { return 123; }
});