mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-30 04:16:48 -05:00
Accept new baselines
This commit is contained in:
@@ -370,7 +370,7 @@ function f14(x: 0 | 1 | 2, y: string) {
|
||||
>y : string
|
||||
|
||||
var b = x || y;
|
||||
>b : string | number
|
||||
>b : string | 1 | 2
|
||||
>x || y : string | 1 | 2
|
||||
>x : 0 | 1 | 2
|
||||
>y : string
|
||||
@@ -383,25 +383,25 @@ function f15(x: 0 | false, y: 1 | "one") {
|
||||
>y : 1 | "one"
|
||||
|
||||
var a = x && y;
|
||||
>a : number | boolean
|
||||
>a : boolean | 0
|
||||
>x && y : false | 0
|
||||
>x : false | 0
|
||||
>y : 1 | "one"
|
||||
|
||||
var b = y && x;
|
||||
>b : number | boolean
|
||||
>b : boolean | 0
|
||||
>y && x : false | 0
|
||||
>y : 1 | "one"
|
||||
>x : false | 0
|
||||
|
||||
var c = x || y;
|
||||
>c : string | number
|
||||
>c : 1 | "one"
|
||||
>x || y : 1 | "one"
|
||||
>x : false | 0
|
||||
>y : 1 | "one"
|
||||
|
||||
var d = y || x;
|
||||
>d : string | number | boolean
|
||||
>d : boolean | 0 | 1 | "one"
|
||||
>y || x : false | 0 | 1 | "one"
|
||||
>y : 1 | "one"
|
||||
>x : false | 0
|
||||
|
||||
@@ -365,13 +365,13 @@ function f14(x: 0 | 1 | 2, y: string) {
|
||||
>y : string
|
||||
|
||||
var a = x && y;
|
||||
>a : string | number
|
||||
>a : string | 0
|
||||
>x && y : string | 0
|
||||
>x : 0 | 1 | 2
|
||||
>y : string
|
||||
|
||||
var b = x || y;
|
||||
>b : string | number
|
||||
>b : string | 1 | 2
|
||||
>x || y : string | 1 | 2
|
||||
>x : 0 | 1 | 2
|
||||
>y : string
|
||||
@@ -384,25 +384,25 @@ function f15(x: 0 | false, y: 1 | "one") {
|
||||
>y : 1 | "one"
|
||||
|
||||
var a = x && y;
|
||||
>a : number | boolean
|
||||
>a : boolean | 0
|
||||
>x && y : false | 0
|
||||
>x : false | 0
|
||||
>y : 1 | "one"
|
||||
|
||||
var b = y && x;
|
||||
>b : number | boolean
|
||||
>b : boolean | 0
|
||||
>y && x : false | 0
|
||||
>y : 1 | "one"
|
||||
>x : false | 0
|
||||
|
||||
var c = x || y;
|
||||
>c : string | number
|
||||
>c : 1 | "one"
|
||||
>x || y : 1 | "one"
|
||||
>x : false | 0
|
||||
>y : 1 | "one"
|
||||
|
||||
var d = y || x;
|
||||
>d : string | number
|
||||
>d : 1 | "one"
|
||||
>y || x : 1 | "one"
|
||||
>y : 1 | "one"
|
||||
>x : false | 0
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndLogicalOrExpressions01.ts(6,5): error TS2322: Type 'string' is not assignable to type '"foo"'.
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndLogicalOrExpressions01.ts(8,5): error TS2322: Type 'string' is not assignable to type '"foo" | "bar"'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndLogicalOrExpressions01.ts (2 errors) ====
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAndLogicalOrExpressions01.ts (1 errors) ====
|
||||
|
||||
declare function myRandBool(): boolean;
|
||||
|
||||
let a: "foo" = "foo";
|
||||
let b = a || "foo";
|
||||
let c: "foo" = b;
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"foo"'.
|
||||
let d = b || "bar";
|
||||
let e: "foo" | "bar" = d;
|
||||
~
|
||||
|
||||
@@ -20,7 +20,7 @@ var e = d;
|
||||
//// [stringLiteralTypesAndLogicalOrExpressions01.d.ts]
|
||||
declare function myRandBool(): boolean;
|
||||
declare let a: "foo";
|
||||
declare let b: string;
|
||||
declare let b: "foo";
|
||||
declare let c: "foo";
|
||||
declare let d: string;
|
||||
declare let e: "foo" | "bar";
|
||||
|
||||
@@ -38,8 +38,8 @@ hResult = h("bar");
|
||||
declare function foo<T extends "foo">(f: (x: T) => T): (x: T) => T;
|
||||
declare function bar<T extends "foo" | "bar">(f: (x: T) => T): (x: T) => T;
|
||||
declare let f: (x: "foo") => "foo";
|
||||
declare let fResult: string;
|
||||
declare let fResult: "foo";
|
||||
declare let g: (x: "foo") => "foo";
|
||||
declare let gResult: string;
|
||||
declare let gResult: "foo";
|
||||
declare let h: (x: "foo" | "bar") => "foo" | "bar";
|
||||
declare let hResult: string;
|
||||
declare let hResult: "foo" | "bar";
|
||||
|
||||
@@ -33,7 +33,7 @@ let f = foo(x => x);
|
||||
>x : "foo"
|
||||
|
||||
let fResult = f("foo");
|
||||
>fResult : string
|
||||
>fResult : "foo"
|
||||
>f("foo") : "foo"
|
||||
>f : (x: "foo") => "foo"
|
||||
>"foo" : "foo"
|
||||
@@ -48,7 +48,7 @@ let g = foo((x => x));
|
||||
>x : "foo"
|
||||
|
||||
let gResult = g("foo");
|
||||
>gResult : string
|
||||
>gResult : "foo"
|
||||
>g("foo") : "foo"
|
||||
>g : (x: "foo") => "foo"
|
||||
>"foo" : "foo"
|
||||
@@ -62,14 +62,14 @@ let h = bar(x => x);
|
||||
>x : "foo" | "bar"
|
||||
|
||||
let hResult = h("foo");
|
||||
>hResult : string
|
||||
>hResult : "foo" | "bar"
|
||||
>h("foo") : "foo" | "bar"
|
||||
>h : (x: "foo" | "bar") => "foo" | "bar"
|
||||
>"foo" : "foo"
|
||||
|
||||
hResult = h("bar");
|
||||
>hResult = h("bar") : "foo" | "bar"
|
||||
>hResult : string
|
||||
>hResult : "foo" | "bar"
|
||||
>h("bar") : "foo" | "bar"
|
||||
>h : (x: "foo" | "bar") => "foo" | "bar"
|
||||
>"bar" : "bar"
|
||||
|
||||
@@ -18,4 +18,4 @@ var fResult = f("foo");
|
||||
//// [stringLiteralTypesAsTypeParameterConstraint02.d.ts]
|
||||
declare function foo<T extends "foo">(f: (x: T) => T): (x: T) => T;
|
||||
declare let f: (x: "foo") => "foo";
|
||||
declare let fResult: string;
|
||||
declare let fResult: "foo";
|
||||
|
||||
@@ -26,7 +26,7 @@ let f = foo((y: "foo" | "bar") => y === "foo" ? y : "foo");
|
||||
>"foo" : "foo"
|
||||
|
||||
let fResult = f("foo");
|
||||
>fResult : string
|
||||
>fResult : "foo"
|
||||
>f("foo") : "foo"
|
||||
>f : (x: "foo") => "foo"
|
||||
>"foo" : "foo"
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts(16,9): error TS2322: Type 'string' is not assignable to type '"foo" | "bar" | "baz"'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes01.ts (1 errors) ====
|
||||
|
||||
type T = "foo" | "bar" | "baz";
|
||||
|
||||
var x: "foo" | "bar" | "baz" = undefined;
|
||||
var y: T = undefined;
|
||||
|
||||
if (x === "foo") {
|
||||
let a = x;
|
||||
}
|
||||
else if (x !== "bar") {
|
||||
let b = x || y;
|
||||
}
|
||||
else {
|
||||
let c = x;
|
||||
let d = y;
|
||||
let e: (typeof x) | (typeof y) = c || d;
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"foo" | "bar" | "baz"'.
|
||||
}
|
||||
|
||||
x = y;
|
||||
y = x;
|
||||
@@ -1,62 +1,62 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes02.ts ===
|
||||
|
||||
type T = string | "foo" | "bar" | "baz";
|
||||
>T : string | "foo" | "bar" | "baz"
|
||||
>T : string
|
||||
|
||||
var x: "foo" | "bar" | "baz" | string = undefined;
|
||||
>x : string | "foo" | "bar" | "baz"
|
||||
>x : string
|
||||
>undefined : undefined
|
||||
|
||||
var y: T = undefined;
|
||||
>y : string | "foo" | "bar" | "baz"
|
||||
>T : string | "foo" | "bar" | "baz"
|
||||
>y : string
|
||||
>T : string
|
||||
>undefined : undefined
|
||||
|
||||
if (x === "foo") {
|
||||
>x === "foo" : boolean
|
||||
>x : string | "foo" | "bar" | "baz"
|
||||
>x : string
|
||||
>"foo" : "foo"
|
||||
|
||||
let a = x;
|
||||
>a : string
|
||||
>x : string | "foo"
|
||||
>x : string
|
||||
}
|
||||
else if (x !== "bar") {
|
||||
>x !== "bar" : boolean
|
||||
>x : string | "bar" | "baz"
|
||||
>x : string
|
||||
>"bar" : "bar"
|
||||
|
||||
let b = x || y;
|
||||
>b : string
|
||||
>x || y : string
|
||||
>x : string | "baz"
|
||||
>y : string | "foo" | "bar" | "baz"
|
||||
>x : string
|
||||
>y : string
|
||||
}
|
||||
else {
|
||||
let c = x;
|
||||
>c : string
|
||||
>x : string | "bar"
|
||||
>x : string
|
||||
|
||||
let d = y;
|
||||
>d : string
|
||||
>y : string | "foo" | "bar" | "baz"
|
||||
>y : string
|
||||
|
||||
let e: (typeof x) | (typeof y) = c || d;
|
||||
>e : string | "foo" | "bar" | "baz"
|
||||
>x : string | "bar"
|
||||
>y : string | "foo" | "bar" | "baz"
|
||||
>e : string
|
||||
>x : string
|
||||
>y : string
|
||||
>c || d : string
|
||||
>c : string
|
||||
>d : string
|
||||
}
|
||||
|
||||
x = y;
|
||||
>x = y : string | "foo" | "bar" | "baz"
|
||||
>x : string | "foo" | "bar" | "baz"
|
||||
>y : string | "foo" | "bar" | "baz"
|
||||
>x = y : string
|
||||
>x : string
|
||||
>y : string
|
||||
|
||||
y = x;
|
||||
>y = x : string | "foo" | "bar" | "baz"
|
||||
>y : string | "foo" | "bar" | "baz"
|
||||
>x : string | "foo" | "bar" | "baz"
|
||||
>y = x : string
|
||||
>y : string
|
||||
>x : string
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts(16,9): error TS2322: Type 'string | number' is not assignable to type 'number | "foo" | "bar"'.
|
||||
Type 'string' is not assignable to type 'number | "foo" | "bar"'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesInUnionTypes03.ts (1 errors) ====
|
||||
|
||||
type T = number | "foo" | "bar";
|
||||
|
||||
var x: "foo" | "bar" | number;
|
||||
var y: T = undefined;
|
||||
|
||||
if (x === "foo") {
|
||||
let a = x;
|
||||
}
|
||||
else if (x !== "bar") {
|
||||
let b = x || y;
|
||||
}
|
||||
else {
|
||||
let c = x;
|
||||
let d = y;
|
||||
let e: (typeof x) | (typeof y) = c || d;
|
||||
~
|
||||
!!! error TS2322: Type 'string | number' is not assignable to type 'number | "foo" | "bar"'.
|
||||
!!! error TS2322: Type 'string' is not assignable to type 'number | "foo" | "bar"'.
|
||||
}
|
||||
|
||||
x = y;
|
||||
y = x;
|
||||
@@ -19,7 +19,7 @@ if (x === "") {
|
||||
>"" : ""
|
||||
|
||||
let a = x;
|
||||
>a : string
|
||||
>a : ""
|
||||
>x : ""
|
||||
}
|
||||
|
||||
@@ -29,7 +29,7 @@ if (x !== "") {
|
||||
>"" : ""
|
||||
|
||||
let b = x;
|
||||
>b : string
|
||||
>b : "foo"
|
||||
>x : "foo"
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ if (x == "") {
|
||||
>"" : ""
|
||||
|
||||
let c = x;
|
||||
>c : string
|
||||
>c : ""
|
||||
>x : ""
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ if (x != "") {
|
||||
>"" : ""
|
||||
|
||||
let d = x;
|
||||
>d : string
|
||||
>d : "foo"
|
||||
>x : "foo"
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ if (x) {
|
||||
>x : T
|
||||
|
||||
let e = x;
|
||||
>e : string
|
||||
>e : "foo"
|
||||
>x : "foo"
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ if (!x) {
|
||||
>x : T
|
||||
|
||||
let f = x;
|
||||
>f : string
|
||||
>f : T
|
||||
>x : T
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ if (!!x) {
|
||||
>x : T
|
||||
|
||||
let g = x;
|
||||
>g : string
|
||||
>g : "foo"
|
||||
>x : "foo"
|
||||
}
|
||||
|
||||
@@ -87,6 +87,6 @@ if (!!!x) {
|
||||
>x : T
|
||||
|
||||
let h = x;
|
||||
>h : string
|
||||
>h : T
|
||||
>x : T
|
||||
}
|
||||
|
||||
@@ -42,12 +42,12 @@ if (kindIs(x, "A")) {
|
||||
>"A" : "A"
|
||||
|
||||
let a = x;
|
||||
>a : string
|
||||
>a : "A"
|
||||
>x : "A"
|
||||
}
|
||||
else {
|
||||
let b = x;
|
||||
>b : string
|
||||
>b : "B"
|
||||
>x : "B"
|
||||
}
|
||||
|
||||
@@ -59,11 +59,11 @@ if (!kindIs(x, "B")) {
|
||||
>"B" : "B"
|
||||
|
||||
let c = x;
|
||||
>c : string
|
||||
>c : "A"
|
||||
>x : "A"
|
||||
}
|
||||
else {
|
||||
let d = x;
|
||||
>d : string
|
||||
>d : "B"
|
||||
>x : "B"
|
||||
}
|
||||
|
||||
@@ -11,17 +11,21 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(55,43): error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(57,52): error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(58,43): error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(68,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(70,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(75,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(77,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(61,5): error TS2322: Type 'string' is not assignable to type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(63,5): error TS2322: Type 'string' is not assignable to type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(75,5): error TS2322: Type '"Hello" | "World"' is not assignable to type '"Hello"'.
|
||||
Type '"World"' is not assignable to type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(77,5): error TS2322: Type '"Hello" | "World"' is not assignable to type '"Hello"'.
|
||||
Type '"World"' is not assignable to type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(87,43): error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(88,43): error TS2345: Argument of type '"Hello"' is not assignable to parameter of type '"World"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(89,52): error TS2345: Argument of type '"World"' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(100,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(104,25): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(107,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(111,30): error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(93,5): error TS2322: Type 'string' is not assignable to type '"Hello" | "World"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(97,5): error TS2322: Type 'string' is not assignable to type '"Hello" | "World"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(100,25): error TS2345: Argument of type '"Hello" | "World"' is not assignable to parameter of type '"Hello"'.
|
||||
Type '"World"' is not assignable to type '"Hello"'.
|
||||
tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts(104,25): error TS2345: Argument of type '"Hello" | "World"' is not assignable to parameter of type '"Hello"'.
|
||||
Type '"World"' is not assignable to type '"Hello"'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes01.ts (24 errors) ====
|
||||
@@ -112,30 +116,32 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0
|
||||
|
||||
// Assignment from the returned value should cause an error.
|
||||
a = takeReturnString(a);
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"Hello"'.
|
||||
b = takeReturnString(b);
|
||||
c = takeReturnString(c);
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"Hello"'.
|
||||
d = takeReturnString(d);
|
||||
e = takeReturnString(e);
|
||||
|
||||
// Should be valid
|
||||
a = takeReturnHello(a);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
b = takeReturnHello(b);
|
||||
c = takeReturnHello(c);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
d = takeReturnHello(d);
|
||||
e = takeReturnHello(e);
|
||||
|
||||
// Assignment from the returned value should cause an error.
|
||||
a = takeReturnHelloWorld(a);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'.
|
||||
~
|
||||
!!! error TS2322: Type '"Hello" | "World"' is not assignable to type '"Hello"'.
|
||||
!!! error TS2322: Type '"World"' is not assignable to type '"Hello"'.
|
||||
b = takeReturnHelloWorld(b);
|
||||
c = takeReturnHelloWorld(c);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'.
|
||||
~
|
||||
!!! error TS2322: Type '"Hello" | "World"' is not assignable to type '"Hello"'.
|
||||
!!! error TS2322: Type '"World"' is not assignable to type '"Hello"'.
|
||||
d = takeReturnHelloWorld(d);
|
||||
e = takeReturnHelloWorld(e);
|
||||
}
|
||||
@@ -158,30 +164,32 @@ tests/cases/conformance/types/stringLiteral/typeArgumentsWithStringLiteralTypes0
|
||||
|
||||
// Assignment from the returned value should cause an error.
|
||||
a = takeReturnString(a);
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"Hello" | "World"'.
|
||||
b = takeReturnString(b);
|
||||
c = takeReturnString(c);
|
||||
d = takeReturnString(d);
|
||||
e = takeReturnString(e);
|
||||
~
|
||||
!!! error TS2322: Type 'string' is not assignable to type '"Hello" | "World"'.
|
||||
|
||||
// Passing these as arguments should cause an error.
|
||||
a = takeReturnHello(a);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
!!! error TS2345: Argument of type '"Hello" | "World"' is not assignable to parameter of type '"Hello"'.
|
||||
!!! error TS2345: Type '"World"' is not assignable to type '"Hello"'.
|
||||
b = takeReturnHello(b);
|
||||
c = takeReturnHello(c);
|
||||
d = takeReturnHello(d);
|
||||
e = takeReturnHello(e);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello"'.
|
||||
!!! error TS2345: Argument of type '"Hello" | "World"' is not assignable to parameter of type '"Hello"'.
|
||||
!!! error TS2345: Type '"World"' is not assignable to type '"Hello"'.
|
||||
|
||||
// Both should be valid.
|
||||
a = takeReturnHelloWorld(a);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'.
|
||||
b = takeReturnHelloWorld(b);
|
||||
c = takeReturnHelloWorld(c);
|
||||
d = takeReturnHelloWorld(d);
|
||||
e = takeReturnHelloWorld(e);
|
||||
~
|
||||
!!! error TS2345: Argument of type 'string' is not assignable to parameter of type '"Hello" | "World"'.
|
||||
}
|
||||
@@ -229,16 +229,16 @@ declare namespace n1 {
|
||||
let e: string;
|
||||
}
|
||||
declare namespace n2 {
|
||||
let a: string;
|
||||
let a: "Hello";
|
||||
let b: any;
|
||||
let c: string;
|
||||
let c: "Hello";
|
||||
let d: any;
|
||||
let e: any;
|
||||
}
|
||||
declare namespace n3 {
|
||||
let a: string;
|
||||
let a: "Hello" | "World";
|
||||
let b: any;
|
||||
let c: any;
|
||||
let d: any;
|
||||
let e: string;
|
||||
let e: "Hello" | "World";
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ var species = foge[Symbol.species];
|
||||
>species : symbol
|
||||
|
||||
var stringTag = foge[Symbol.toStringTag];
|
||||
>stringTag : string
|
||||
>stringTag : "SharedArrayBuffer"
|
||||
>foge[Symbol.toStringTag] : "SharedArrayBuffer"
|
||||
>foge : SharedArrayBuffer
|
||||
>Symbol.toStringTag : symbol
|
||||
|
||||
@@ -15,7 +15,7 @@ var species = foge[Symbol.species];
|
||||
>species : symbol
|
||||
|
||||
var stringTag = foge[Symbol.toStringTag];
|
||||
>stringTag : string
|
||||
>stringTag : "SharedArrayBuffer"
|
||||
>foge[Symbol.toStringTag] : "SharedArrayBuffer"
|
||||
>foge : SharedArrayBuffer
|
||||
>Symbol.toStringTag : symbol
|
||||
|
||||
@@ -15,7 +15,7 @@ var species = foge[Symbol.species];
|
||||
>species : symbol
|
||||
|
||||
var stringTag = foge[Symbol.toStringTag];
|
||||
>stringTag : string
|
||||
>stringTag : "SharedArrayBuffer"
|
||||
>foge[Symbol.toStringTag] : "SharedArrayBuffer"
|
||||
>foge : SharedArrayBuffer
|
||||
>Symbol.toStringTag : symbol
|
||||
|
||||
Reference in New Issue
Block a user