From 647e1836c3a8898d85b5c5a9371cd9bb98eec2b1 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 30 Jan 2017 16:53:43 -0800 Subject: [PATCH] Add tests --- .../types/mapped/mappedTypesAndObjects.ts | 24 +++++++++++++------ 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts b/tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts index 8023f6e7d8d..b3530b46965 100644 --- a/tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts +++ b/tests/cases/conformance/types/mapped/mappedTypesAndObjects.ts @@ -13,23 +13,33 @@ function f2(x: Partial, y: Readonly) { obj = y; } +function f3(x: Partial) { + x = {}; +} + // Repro from #12900 interface Base { - foo: { [key: string]: any }; - bar: any; - baz: any; + foo: { [key: string]: any }; + bar: any; + baz: any; } interface E1 extends Base { - foo: T; + foo: T; } interface Something { name: string, value: string }; interface E2 extends Base { - foo: Partial; // or other mapped type + foo: Partial; // or other mapped type } interface E3 extends Base { - foo: Partial; // or other mapped type -} \ No newline at end of file + foo: Partial; // or other mapped type +} + +// Repro from #13747 + +class Form { + private values: {[P in keyof T]?: T[P]} = {} +}