From 34ec8956421bdedbc53277e2d4c7fcb35ccf9e4d Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 1 Feb 2017 09:47:30 -0800 Subject: [PATCH] Add regression test --- .../types/keyof/keyofAndIndexedAccess.ts | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts index a8a5acd450f..70b70dff6ea 100644 --- a/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts +++ b/tests/cases/conformance/types/keyof/keyofAndIndexedAccess.ts @@ -527,3 +527,30 @@ class Form { this.childFormFactories[prop](value) } } + +// Repro from #13787 + +class SampleClass

{ + public props: Readonly

; + constructor(props: P) { + this.props = Object.freeze(props); + } +} + +interface Foo { + foo: string; +} + +declare function merge(obj1: T, obj2: U): T & U; + +class AnotherSampleClass extends SampleClass { + constructor(props: T) { + const foo: Foo = { foo: "bar" }; + super(merge(props, foo)); + } + + public brokenMethod() { + this.props.foo.concat; + } +} +new AnotherSampleClass({});