TypeScript/tests/cases/compiler/homomorphicMappedTypeIntersectionAssignability.ts
Wesley Wigham 3a2f7c0df1
Allow intersections of readonlys to be assignable to a readonly intersection (#28218)
* Allow intersections of readonlys to be assignable to a readonly intersection

* Add real motivating react example to test suite
2018-10-31 14:09:12 -07:00

9 lines
246 B
TypeScript

// @strict: true
function f<TType>(
a: { weak?: string } & Readonly<TType> & { name: "ok" },
b: Readonly<TType & { name: string }>,
c: Readonly<TType> & { name: string }) {
c = a; // Works
b = a; // Should also work
}