Skip to content

Commit decec4d

Browse files
Accepted baselines.
1 parent 5f9983a commit decec4d

6 files changed

+71
-24
lines changed

tests/baselines/reference/overloadOnConstAsTypeAnnotation.errors.txt

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
//// [overloadOnConstAsTypeAnnotation.ts]
22

3-
var f: (x: 'hi') => number = ('hi') => { return 1; };
3+
var f: (x: 'hi') => number = (x: 'hi') => { return 1; };
44

55
//// [overloadOnConstAsTypeAnnotation.js]
6-
var f = ('hi');
7-
{
8-
return 1;
9-
}
10-
;
6+
var f = function (x) { return 1; };
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
=== tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts ===
2+
3+
var f: (x: 'hi') => number = (x: 'hi') => { return 1; };
4+
>f : Symbol(f, Decl(overloadOnConstAsTypeAnnotation.ts, 1, 3))
5+
>x : Symbol(x, Decl(overloadOnConstAsTypeAnnotation.ts, 1, 8))
6+
>x : Symbol(x, Decl(overloadOnConstAsTypeAnnotation.ts, 1, 30))
7+
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
=== tests/cases/compiler/overloadOnConstAsTypeAnnotation.ts ===
2+
3+
var f: (x: 'hi') => number = (x: 'hi') => { return 1; };
4+
>f : (x: "hi") => number
5+
>x : "hi"
6+
>(x: 'hi') => { return 1; } : (x: "hi") => number
7+
>x : "hi"
8+
>1 : number
9+

tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.errors.txt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(4,10): error TS2394: Overload signature is not compatible with function implementation.
1+
tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts(2,10): error TS2394: Overload signature is not compatible with function implementation.
22

33

44
==== tests/cases/conformance/types/objectTypeLiteral/callSignatures/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts (1 errors) ====
5-
// Specialized signatures must be a subtype of a non-specialized signature
6-
// All the below should be errors
75

86
function foo(x: 'a');
97
~~~

tests/baselines/reference/specializedSignatureIsNotSubtypeOfNonSpecializedSignature.js

Lines changed: 52 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
//// [specializedSignatureIsNotSubtypeOfNonSpecializedSignature.ts]
2-
// Specialized signatures must be a subtype of a non-specialized signature
3-
// All the below should be errors
42

53
function foo(x: 'a');
64
function foo(x: number) { }
@@ -67,8 +65,6 @@ var a3: {
6765

6866

6967
//// [specializedSignatureIsNotSubtypeOfNonSpecializedSignature.js]
70-
// Specialized signatures must be a subtype of a non-specialized signature
71-
// All the below should be errors
7268
function foo(x) { }
7369
var C = (function () {
7470
function C() {
@@ -91,3 +87,55 @@ var C3 = (function () {
9187
var a;
9288
var a2;
9389
var a3;
90+
91+
92+
//// [specializedSignatureIsNotSubtypeOfNonSpecializedSignature.d.ts]
93+
declare function foo(x: 'a'): any;
94+
declare class C {
95+
foo(x: 'a'): any;
96+
foo(x: number): any;
97+
}
98+
declare class C2<T> {
99+
foo(x: 'a'): any;
100+
foo(x: T): any;
101+
}
102+
declare class C3<T extends String> {
103+
foo(x: 'a'): any;
104+
foo(x: T): any;
105+
}
106+
interface I {
107+
(x: 'a'): any;
108+
(x: number): any;
109+
foo(x: 'a'): any;
110+
foo(x: number): any;
111+
}
112+
interface I2<T> {
113+
(x: 'a'): any;
114+
(x: T): any;
115+
foo(x: 'a'): any;
116+
foo(x: T): any;
117+
}
118+
interface I3<T extends String> {
119+
(x: 'a'): any;
120+
(x: T): any;
121+
foo(x: 'a'): any;
122+
foo(x: T): any;
123+
}
124+
declare var a: {
125+
(x: 'a');
126+
(x: number);
127+
foo(x: 'a');
128+
foo(x: number);
129+
};
130+
declare var a2: {
131+
(x: 'a');
132+
<T>(x: T);
133+
foo(x: 'a');
134+
foo<T>(x: T);
135+
};
136+
declare var a3: {
137+
(x: 'a');
138+
<T>(x: T);
139+
foo(x: 'a');
140+
foo<T extends String>(x: T);
141+
};

0 commit comments

Comments
 (0)