From 1e3625c952967aaf93a9bb02c1e9022d7b6b17f7 Mon Sep 17 00:00:00 2001 From: Anders Hejlsberg Date: Mon, 10 Sep 2018 15:47:48 -0700 Subject: [PATCH] Accept new baselines --- ...eralsContextuallyTypedFromUnion.errors.txt | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 tests/baselines/reference/booleanLiteralsContextuallyTypedFromUnion.errors.txt diff --git a/tests/baselines/reference/booleanLiteralsContextuallyTypedFromUnion.errors.txt b/tests/baselines/reference/booleanLiteralsContextuallyTypedFromUnion.errors.txt new file mode 100644 index 00000000000..5b8fb9b0ea8 --- /dev/null +++ b/tests/baselines/reference/booleanLiteralsContextuallyTypedFromUnion.errors.txt @@ -0,0 +1,31 @@ +error TS2318: Cannot find global type 'CallableFunction'. +error TS2318: Cannot find global type 'NewableFunction'. + + +!!! error TS2318: Cannot find global type 'CallableFunction'. +!!! error TS2318: Cannot find global type 'NewableFunction'. +==== tests/cases/compiler/booleanLiteralsContextuallyTypedFromUnion.tsx (0 errors) ==== + interface A { isIt: true; text: string; } + interface B { isIt: false; value: number; } + type C = A | B; + const isIt = Math.random() > 0.5; + const c: C = isIt ? { isIt, text: 'hey' } : { isIt, value: 123 }; + const cc: C = isIt ? { isIt: isIt, text: 'hey' } : { isIt: isIt, value: 123 }; + + type ComponentProps = + | { + optionalBool: true; + mandatoryFn: () => void; + } + | { + optionalBool: false; + }; + + let Funk = (_props: ComponentProps) =>
Hello
; + + let Fail1 = () => { }} optionalBool={true} /> + let Fail2 = () => { }} optionalBool={true as true} /> + let True = true as true; + let Fail3 = () => { }} optionalBool={True} /> + let attrs2 = { optionalBool: true as true, mandatoryFn: () => { } } + let Success = () => \ No newline at end of file