Skip to content

Commit 86f6378

Browse files
committed
Accept baselines
1 parent 455ccce commit 86f6378

File tree

2 files changed

+61
-1
lines changed

2 files changed

+61
-1
lines changed

tests/baselines/reference/declarationFiles.errors.txt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,18 @@
1+
tests/cases/conformance/types/thisType/declarationFiles.ts(5,20): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
12
tests/cases/conformance/types/thisType/declarationFiles.ts(31,5): error TS2527: The inferred type of 'x1' references an inaccessible 'this' type. A type annotation is necessary.
23
tests/cases/conformance/types/thisType/declarationFiles.ts(33,5): error TS2527: The inferred type of 'x3' references an inaccessible 'this' type. A type annotation is necessary.
34
tests/cases/conformance/types/thisType/declarationFiles.ts(35,5): error TS2527: The inferred type of 'f1' references an inaccessible 'this' type. A type annotation is necessary.
45
tests/cases/conformance/types/thisType/declarationFiles.ts(41,5): error TS2527: The inferred type of 'f3' references an inaccessible 'this' type. A type annotation is necessary.
56

67

7-
==== tests/cases/conformance/types/thisType/declarationFiles.ts (4 errors) ====
8+
==== tests/cases/conformance/types/thisType/declarationFiles.ts (5 errors) ====
89

910
class C1 {
1011
x: this;
1112
f(x: this): this { return undefined; }
1213
constructor(x: this) { }
14+
~~~~
15+
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
1316
}
1417

1518
class C2 {
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
tests/cases/conformance/types/thisType/thisTypeInClasses.ts(4,20): error TS2526: A 'this' type is available only in a non-static member of a class or interface.
2+
3+
4+
==== tests/cases/conformance/types/thisType/thisTypeInClasses.ts (1 errors) ====
5+
class C1 {
6+
x: this;
7+
f(x: this): this { return undefined; }
8+
constructor(x: this) { }
9+
~~~~
10+
!!! error TS2526: A 'this' type is available only in a non-static member of a class or interface.
11+
}
12+
13+
class C2 {
14+
[x: string]: this;
15+
}
16+
17+
interface Foo<T> {
18+
x: T;
19+
y: this;
20+
}
21+
22+
class C3 {
23+
a: this[];
24+
b: [this, this];
25+
c: this | Date;
26+
d: this & Date;
27+
e: (((this)));
28+
f: (x: this) => this;
29+
g: new (x: this) => this;
30+
h: Foo<this>;
31+
i: Foo<this | (() => this)>;
32+
j: (x: any) => x is this;
33+
}
34+
35+
declare class C4 {
36+
x: this;
37+
f(x: this): this;
38+
}
39+
40+
class C5 {
41+
foo() {
42+
let f1 = (x: this): this => this;
43+
let f2 = (x: this) => this;
44+
let f3 = (x: this) => (y: this) => this;
45+
let f4 = (x: this) => {
46+
let g = (y: this) => {
47+
return () => this;
48+
}
49+
return g(this);
50+
}
51+
}
52+
bar() {
53+
let x1 = <this>undefined;
54+
let x2 = undefined as this;
55+
}
56+
}
57+

0 commit comments

Comments
 (0)