Skip to content

Commit 1d9c3e1

Browse files
committed
Add repro
1 parent a48b222 commit 1d9c3e1

File tree

4 files changed

+134
-0
lines changed

4 files changed

+134
-0
lines changed
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
//// [mappedTypePartialConstraints.ts]
2+
// Repro from #16985
3+
4+
interface MyInterface {
5+
something: number;
6+
}
7+
8+
class MyClass<T extends MyInterface> {
9+
doIt(data : Partial<T>) {}
10+
}
11+
12+
class MySubClass extends MyClass<MyInterface> {}
13+
14+
function fn(arg: typeof MyClass) {};
15+
16+
fn(MySubClass);
17+
18+
19+
//// [mappedTypePartialConstraints.js]
20+
// Repro from #16985
21+
var __extends = (this && this.__extends) || (function () {
22+
var extendStatics = Object.setPrototypeOf ||
23+
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
24+
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
25+
return function (d, b) {
26+
extendStatics(d, b);
27+
function __() { this.constructor = d; }
28+
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
29+
};
30+
})();
31+
var MyClass = (function () {
32+
function MyClass() {
33+
}
34+
MyClass.prototype.doIt = function (data) { };
35+
return MyClass;
36+
}());
37+
var MySubClass = (function (_super) {
38+
__extends(MySubClass, _super);
39+
function MySubClass() {
40+
return _super !== null && _super.apply(this, arguments) || this;
41+
}
42+
return MySubClass;
43+
}(MyClass));
44+
function fn(arg) { }
45+
;
46+
fn(MySubClass);
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
=== tests/cases/compiler/mappedTypePartialConstraints.ts ===
2+
// Repro from #16985
3+
4+
interface MyInterface {
5+
>MyInterface : Symbol(MyInterface, Decl(mappedTypePartialConstraints.ts, 0, 0))
6+
7+
something: number;
8+
>something : Symbol(MyInterface.something, Decl(mappedTypePartialConstraints.ts, 2, 23))
9+
}
10+
11+
class MyClass<T extends MyInterface> {
12+
>MyClass : Symbol(MyClass, Decl(mappedTypePartialConstraints.ts, 4, 1))
13+
>T : Symbol(T, Decl(mappedTypePartialConstraints.ts, 6, 14))
14+
>MyInterface : Symbol(MyInterface, Decl(mappedTypePartialConstraints.ts, 0, 0))
15+
16+
doIt(data : Partial<T>) {}
17+
>doIt : Symbol(MyClass.doIt, Decl(mappedTypePartialConstraints.ts, 6, 38))
18+
>data : Symbol(data, Decl(mappedTypePartialConstraints.ts, 7, 7))
19+
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
20+
>T : Symbol(T, Decl(mappedTypePartialConstraints.ts, 6, 14))
21+
}
22+
23+
class MySubClass extends MyClass<MyInterface> {}
24+
>MySubClass : Symbol(MySubClass, Decl(mappedTypePartialConstraints.ts, 8, 1))
25+
>MyClass : Symbol(MyClass, Decl(mappedTypePartialConstraints.ts, 4, 1))
26+
>MyInterface : Symbol(MyInterface, Decl(mappedTypePartialConstraints.ts, 0, 0))
27+
28+
function fn(arg: typeof MyClass) {};
29+
>fn : Symbol(fn, Decl(mappedTypePartialConstraints.ts, 10, 48))
30+
>arg : Symbol(arg, Decl(mappedTypePartialConstraints.ts, 12, 12))
31+
>MyClass : Symbol(MyClass, Decl(mappedTypePartialConstraints.ts, 4, 1))
32+
33+
fn(MySubClass);
34+
>fn : Symbol(fn, Decl(mappedTypePartialConstraints.ts, 10, 48))
35+
>MySubClass : Symbol(MySubClass, Decl(mappedTypePartialConstraints.ts, 8, 1))
36+
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
=== tests/cases/compiler/mappedTypePartialConstraints.ts ===
2+
// Repro from #16985
3+
4+
interface MyInterface {
5+
>MyInterface : MyInterface
6+
7+
something: number;
8+
>something : number
9+
}
10+
11+
class MyClass<T extends MyInterface> {
12+
>MyClass : MyClass<T>
13+
>T : T
14+
>MyInterface : MyInterface
15+
16+
doIt(data : Partial<T>) {}
17+
>doIt : (data: Partial<T>) => void
18+
>data : Partial<T>
19+
>Partial : Partial<T>
20+
>T : T
21+
}
22+
23+
class MySubClass extends MyClass<MyInterface> {}
24+
>MySubClass : MySubClass
25+
>MyClass : MyClass<MyInterface>
26+
>MyInterface : MyInterface
27+
28+
function fn(arg: typeof MyClass) {};
29+
>fn : (arg: typeof MyClass) => void
30+
>arg : typeof MyClass
31+
>MyClass : typeof MyClass
32+
33+
fn(MySubClass);
34+
>fn(MySubClass) : void
35+
>fn : (arg: typeof MyClass) => void
36+
>MySubClass : typeof MySubClass
37+
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Repro from #16985
2+
3+
interface MyInterface {
4+
something: number;
5+
}
6+
7+
class MyClass<T extends MyInterface> {
8+
doIt(data : Partial<T>) {}
9+
}
10+
11+
class MySubClass extends MyClass<MyInterface> {}
12+
13+
function fn(arg: typeof MyClass) {};
14+
15+
fn(MySubClass);

0 commit comments

Comments
 (0)