From 3ec5ac28e789ef69289b6d9d19cc31d53dd97bf6 Mon Sep 17 00:00:00 2001 From: Daniel Rosenwasser Date: Wed, 26 Feb 2020 17:07:39 -0800 Subject: [PATCH] Accepted baselines. --- ...AssertionsInEqualityComparisons02.errors.txt | 8 +++++++- ...tringLiteralsWithTypeAssertions01.errors.txt | 17 +++++++++++++++++ 2 files changed, 24 insertions(+), 1 deletion(-) create mode 100644 tests/baselines/reference/stringLiteralsWithTypeAssertions01.errors.txt diff --git a/tests/baselines/reference/stringLiteralsAssertionsInEqualityComparisons02.errors.txt b/tests/baselines/reference/stringLiteralsAssertionsInEqualityComparisons02.errors.txt index 8cb9e8203e7..59a242c0624 100644 --- a/tests/baselines/reference/stringLiteralsAssertionsInEqualityComparisons02.errors.txt +++ b/tests/baselines/reference/stringLiteralsAssertionsInEqualityComparisons02.errors.txt @@ -1,15 +1,21 @@ tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparisons02.ts(3,9): error TS2367: This condition will always return 'false' since the types '"foo"' and '"baz"' have no overlap. +tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparisons02.ts(3,19): error TS2352: Conversion of type 'bar' to type '"baz"' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. +tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparisons02.ts(4,20): error TS2352: Conversion of type 'bar' to type '"foo"' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparisons02.ts(5,9): error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap. tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparisons02.ts(5,19): error TS2352: Conversion of type 'string' to type 'number' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. -==== tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparisons02.ts (3 errors) ==== +==== tests/cases/conformance/types/literal/stringLiteralsAssertionsInEqualityComparisons02.ts (5 errors) ==== type EnhancedString = string & { enhancements: any }; var a = "foo" === "bar" as "baz"; ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2367: This condition will always return 'false' since the types '"foo"' and '"baz"' have no overlap. + ~~~~~~~~~~~~~~ +!!! error TS2352: Conversion of type 'bar' to type '"baz"' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. var b = "foo" !== ("bar" as "foo"); + ~~~~~~~~~~~~~~ +!!! error TS2352: Conversion of type 'bar' to type '"foo"' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. var c = "foo" == ("bar"); ~~~~~~~~~~~~~~~~~~~~~~~~ !!! error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap. diff --git a/tests/baselines/reference/stringLiteralsWithTypeAssertions01.errors.txt b/tests/baselines/reference/stringLiteralsWithTypeAssertions01.errors.txt new file mode 100644 index 00000000000..020a4722ce6 --- /dev/null +++ b/tests/baselines/reference/stringLiteralsWithTypeAssertions01.errors.txt @@ -0,0 +1,17 @@ +tests/cases/conformance/types/literal/stringLiteralsWithTypeAssertions01.ts(3,9): error TS2352: Conversion of type 'foo' to type '"bar"' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. +tests/cases/conformance/types/literal/stringLiteralsWithTypeAssertions01.ts(4,9): error TS2352: Conversion of type 'bar' to type '"foo"' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. + + +==== tests/cases/conformance/types/literal/stringLiteralsWithTypeAssertions01.ts (2 errors) ==== + let fooOrBar: "foo" | "bar"; + + let a = "foo" as "bar"; + ~~~~~~~~~~~~~~ +!!! error TS2352: Conversion of type 'foo' to type '"bar"' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. + let b = "bar" as "foo"; + ~~~~~~~~~~~~~~ +!!! error TS2352: Conversion of type 'bar' to type '"foo"' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first. + let c = fooOrBar as "foo"; + let d = fooOrBar as "bar"; + let e = fooOrBar as "baz"; + let f = "baz" as typeof fooOrBar; \ No newline at end of file