-
Notifications
You must be signed in to change notification settings - Fork 12.8k
/
Copy pathrecursiveClassBaseType.js
92 lines (81 loc) · 2.47 KB
/
recursiveClassBaseType.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
//// [tests/cases/compiler/recursiveClassBaseType.ts] ////
//// [recursiveClassBaseType.ts]
// Repro from #44281
declare const p: <T>(fn: () => T) => T;
declare const Base: <T>(val: T) => { new(): T };
class C extends Base({ x: p<C[]>(() => []) }) { }
// Repro from #44359
abstract class Base1 {
abstract root(): Derived1;
}
class Derived1 extends class extends Base1 {
root() {
return undefined as any;
}
}
{ }
//// [recursiveClassBaseType.js]
"use strict";
// Repro from #44281
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var C = /** @class */ (function (_super) {
__extends(C, _super);
function C() {
return _super !== null && _super.apply(this, arguments) || this;
}
return C;
}(Base({ x: p(function () { return []; }) })));
// Repro from #44359
var Base1 = /** @class */ (function () {
function Base1() {
}
return Base1;
}());
var Derived1 = /** @class */ (function (_super) {
__extends(Derived1, _super);
function Derived1() {
return _super !== null && _super.apply(this, arguments) || this;
}
return Derived1;
}(/** @class */ (function (_super) {
__extends(class_1, _super);
function class_1() {
return _super !== null && _super.apply(this, arguments) || this;
}
class_1.prototype.root = function () {
return undefined;
};
return class_1;
}(Base1))));
//// [recursiveClassBaseType.d.ts]
declare const p: <T>(fn: () => T) => T;
declare const Base: <T>(val: T) => {
new (): T;
};
declare class C extends ({} as new () => {
x: C[];
}) {
}
declare abstract class Base1 {
abstract root(): Derived1;
}
declare class Derived1 extends ({} as {
new (): {
root(): any;
};
}) {
}