diff --git a/tests/baselines/reference/assignmentNonObjectTypeConstraints.types b/tests/baselines/reference/assignmentNonObjectTypeConstraints.types index 94391e2ea5f..e2c3176940d 100644 --- a/tests/baselines/reference/assignmentNonObjectTypeConstraints.types +++ b/tests/baselines/reference/assignmentNonObjectTypeConstraints.types @@ -19,14 +19,14 @@ function foo(x: T) { foo(5); >foo(5) : void >foo : (x: T) => void ->5 : number +>5 : 5 foo(E.A); >foo(E.A) : void >foo : (x: T) => void ->E.A : E +>E.A : E.A >E : typeof E ->A : E +>A : E.A class A { a } >A : A diff --git a/tests/baselines/reference/callExpressionWithTypeParameterConstrainedToOuterTypeParameter.types b/tests/baselines/reference/callExpressionWithTypeParameterConstrainedToOuterTypeParameter.types index fe7d3a6ad08..76b8a513702 100644 --- a/tests/baselines/reference/callExpressionWithTypeParameterConstrainedToOuterTypeParameter.types +++ b/tests/baselines/reference/callExpressionWithTypeParameterConstrainedToOuterTypeParameter.types @@ -15,8 +15,8 @@ var i: I; >I : I var y = i(""); // y should be string ->y : string ->i("") : string +>y : "" +>i("") : "" >i : I ->"" : string +>"" : "" diff --git a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt index ab28ccc9c8d..81e43f7d8fe 100644 --- a/tests/baselines/reference/derivedGenericClassWithAny.errors.txt +++ b/tests/baselines/reference/derivedGenericClassWithAny.errors.txt @@ -2,8 +2,8 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(11,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(19,16): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,9): error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,25): error TS2322: Type 'string' is not assignable to type 'T'. -tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,16): error TS2322: Type 'string' is not assignable to type 'T'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(30,25): error TS2322: Type '""' is not assignable to type 'T'. +tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(32,16): error TS2322: Type '""' is not assignable to type 'T'. tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericClassWithAny.ts(41,1): error TS2322: Type 'E' is not assignable to type 'C'. Types of property 'x' are incompatible. Type 'string' is not assignable to type 'number'. @@ -49,11 +49,11 @@ tests/cases/conformance/classes/members/inheritanceAndOverriding/derivedGenericC ~ !!! error TS1056: Accessors are only available when targeting ECMAScript 5 and higher. ~~ -!!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: Type '""' is not assignable to type 'T'. foo(): T { return ''; // error ~~ -!!! error TS2322: Type 'string' is not assignable to type 'T'. +!!! error TS2322: Type '""' is not assignable to type 'T'. } } diff --git a/tests/baselines/reference/newExpressionWithTypeParameterConstrainedToOuterTypeParameter.types b/tests/baselines/reference/newExpressionWithTypeParameterConstrainedToOuterTypeParameter.types index e07fa21fafe..6d541198802 100644 --- a/tests/baselines/reference/newExpressionWithTypeParameterConstrainedToOuterTypeParameter.types +++ b/tests/baselines/reference/newExpressionWithTypeParameterConstrainedToOuterTypeParameter.types @@ -15,8 +15,8 @@ var i: I; >I : I var y = new i(""); // y should be string ->y : string ->new i("") : string +>y : "" +>new i("") : "" >i : I ->"" : string +>"" : "" diff --git a/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.errors.txt b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.errors.txt deleted file mode 100644 index ed6450ad329..00000000000 --- a/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.errors.txt +++ /dev/null @@ -1,15 +0,0 @@ -tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint02.ts(6,13): error TS2345: Argument of type '(y: "foo" | "bar") => string' is not assignable to parameter of type '(x: "foo") => "foo"'. - Type 'string' is not assignable to type '"foo"'. - - -==== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint02.ts (1 errors) ==== - - function foo(f: (x: T) => T) { - return f; - } - - let f = foo((y: "foo" | "bar") => y === "foo" ? y : "foo"); - ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -!!! error TS2345: Argument of type '(y: "foo" | "bar") => string' is not assignable to parameter of type '(x: "foo") => "foo"'. -!!! error TS2345: Type 'string' is not assignable to type '"foo"'. - let fResult = f("foo"); \ No newline at end of file diff --git a/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.js b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.js index c024ac6bc43..173e74a6eef 100644 --- a/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.js +++ b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.js @@ -17,5 +17,5 @@ var fResult = f("foo"); //// [stringLiteralTypesAsTypeParameterConstraint02.d.ts] declare function foo(f: (x: T) => T): (x: T) => T; -declare let f: any; -declare let fResult: any; +declare let f: (x: "foo") => "foo"; +declare let fResult: "foo"; diff --git a/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.symbols b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.symbols new file mode 100644 index 00000000000..1c5eb457788 --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.symbols @@ -0,0 +1,25 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint02.ts === + +function foo(f: (x: T) => T) { +>foo : Symbol(foo, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 0, 0)) +>T : Symbol(T, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 1, 13)) +>f : Symbol(f, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 1, 30)) +>x : Symbol(x, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 1, 34)) +>T : Symbol(T, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 1, 13)) +>T : Symbol(T, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 1, 13)) + + return f; +>f : Symbol(f, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 1, 30)) +} + +let f = foo((y: "foo" | "bar") => y === "foo" ? y : "foo"); +>f : Symbol(f, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 5, 3)) +>foo : Symbol(foo, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 0, 0)) +>y : Symbol(y, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 5, 13)) +>y : Symbol(y, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 5, 13)) +>y : Symbol(y, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 5, 13)) + +let fResult = f("foo"); +>fResult : Symbol(fResult, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 6, 3)) +>f : Symbol(f, Decl(stringLiteralTypesAsTypeParameterConstraint02.ts, 5, 3)) + diff --git a/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.types b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.types new file mode 100644 index 00000000000..3a1b8fdc05c --- /dev/null +++ b/tests/baselines/reference/stringLiteralTypesAsTypeParameterConstraint02.types @@ -0,0 +1,33 @@ +=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint02.ts === + +function foo(f: (x: T) => T) { +>foo : (f: (x: T) => T) => (x: T) => T +>T : T +>f : (x: T) => T +>x : T +>T : T +>T : T + + return f; +>f : (x: T) => T +} + +let f = foo((y: "foo" | "bar") => y === "foo" ? y : "foo"); +>f : (x: "foo") => "foo" +>foo((y: "foo" | "bar") => y === "foo" ? y : "foo") : (x: "foo") => "foo" +>foo : (f: (x: T) => T) => (x: T) => T +>(y: "foo" | "bar") => y === "foo" ? y : "foo" : (y: "foo" | "bar") => "foo" +>y : "foo" | "bar" +>y === "foo" ? y : "foo" : "foo" +>y === "foo" : boolean +>y : "foo" | "bar" +>"foo" : "foo" +>y : "foo" +>"foo" : "foo" + +let fResult = f("foo"); +>fResult : "foo" +>f("foo") : "foo" +>f : (x: "foo") => "foo" +>"foo" : "foo" +