mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-07-04 14:56:16 -05:00
Accept new baselines
This commit is contained in:
@@ -19,14 +19,14 @@ function foo<T extends number>(x: T) {
|
||||
foo(5);
|
||||
>foo(5) : void
|
||||
>foo : <T extends number>(x: T) => void
|
||||
>5 : number
|
||||
>5 : 5
|
||||
|
||||
foo(E.A);
|
||||
>foo(E.A) : void
|
||||
>foo : <T extends number>(x: T) => void
|
||||
>E.A : E
|
||||
>E.A : E.A
|
||||
>E : typeof E
|
||||
>A : E
|
||||
>A : E.A
|
||||
|
||||
class A { a }
|
||||
>A : A
|
||||
|
||||
@@ -15,8 +15,8 @@ var i: I<string>;
|
||||
>I : I<T>
|
||||
|
||||
var y = i(""); // y should be string
|
||||
>y : string
|
||||
>i("") : string
|
||||
>y : ""
|
||||
>i("") : ""
|
||||
>i : I<string>
|
||||
>"" : string
|
||||
>"" : ""
|
||||
|
||||
|
||||
@@ -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<string>' is not assignable to type 'C<number>'.
|
||||
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'.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,8 +15,8 @@ var i: I<string>;
|
||||
>I : I<T>
|
||||
|
||||
var y = new i(""); // y should be string
|
||||
>y : string
|
||||
>new i("") : string
|
||||
>y : ""
|
||||
>new i("") : ""
|
||||
>i : I<string>
|
||||
>"" : string
|
||||
>"" : ""
|
||||
|
||||
|
||||
@@ -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<T extends "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");
|
||||
@@ -17,5 +17,5 @@ var fResult = f("foo");
|
||||
|
||||
//// [stringLiteralTypesAsTypeParameterConstraint02.d.ts]
|
||||
declare function foo<T extends "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";
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint02.ts ===
|
||||
|
||||
function foo<T extends "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))
|
||||
|
||||
@@ -0,0 +1,33 @@
|
||||
=== tests/cases/conformance/types/stringLiteral/stringLiteralTypesAsTypeParameterConstraint02.ts ===
|
||||
|
||||
function foo<T extends "foo">(f: (x: T) => T) {
|
||||
>foo : <T extends "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 : <T extends "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"
|
||||
|
||||
Reference in New Issue
Block a user