From a764729b38046ec438cb4e1772c0c7bf37b3c60f Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Wed, 10 Apr 2019 17:42:08 -1000 Subject: [PATCH] Add tests --- .../typeInference/unionAndIntersectionInference1.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference1.ts b/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference1.ts index d4c7d25615e..18de9c60f2c 100644 --- a/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference1.ts +++ b/tests/cases/conformance/types/typeRelationships/typeInference/unionAndIntersectionInference1.ts @@ -86,7 +86,13 @@ const createTest = (): ITest => { } declare function f1(x: T | U): T | U; -declare function f2(x: T & U): T & U; +declare function f2(x: T, y: U): T | U; let x1: string = f1('a'); -let x2: string = f2('a'); +let x2: string = f2('a', 'b'); + +// Repro from #30442 + +const func = () => {}; +const assign = (a: T, b: U) => Object.assign(a, b); +const res: (() => void) & { func: any } = assign(() => {}, { func });