Accepted baselines.

This commit is contained in:
Daniel Rosenwasser
2020-02-26 17:07:39 -08:00
parent 80fc6dc7e1
commit 3ec5ac28e7
2 changed files with 24 additions and 1 deletions

View File

@@ -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" == (<number>"bar");
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS2367: This condition will always return 'false' since the types 'string' and 'number' have no overlap.

View File

@@ -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;