mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-10 18:04:18 -05:00
Add repro
This commit is contained in:
46
tests/baselines/reference/mappedTypePartialConstraints.js
Normal file
46
tests/baselines/reference/mappedTypePartialConstraints.js
Normal file
@@ -0,0 +1,46 @@
|
||||
//// [mappedTypePartialConstraints.ts]
|
||||
// Repro from #16985
|
||||
|
||||
interface MyInterface {
|
||||
something: number;
|
||||
}
|
||||
|
||||
class MyClass<T extends MyInterface> {
|
||||
doIt(data : Partial<T>) {}
|
||||
}
|
||||
|
||||
class MySubClass extends MyClass<MyInterface> {}
|
||||
|
||||
function fn(arg: typeof MyClass) {};
|
||||
|
||||
fn(MySubClass);
|
||||
|
||||
|
||||
//// [mappedTypePartialConstraints.js]
|
||||
// Repro from #16985
|
||||
var __extends = (this && this.__extends) || (function () {
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
return function (d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
})();
|
||||
var MyClass = (function () {
|
||||
function MyClass() {
|
||||
}
|
||||
MyClass.prototype.doIt = function (data) { };
|
||||
return MyClass;
|
||||
}());
|
||||
var MySubClass = (function (_super) {
|
||||
__extends(MySubClass, _super);
|
||||
function MySubClass() {
|
||||
return _super !== null && _super.apply(this, arguments) || this;
|
||||
}
|
||||
return MySubClass;
|
||||
}(MyClass));
|
||||
function fn(arg) { }
|
||||
;
|
||||
fn(MySubClass);
|
||||
@@ -0,0 +1,36 @@
|
||||
=== tests/cases/compiler/mappedTypePartialConstraints.ts ===
|
||||
// Repro from #16985
|
||||
|
||||
interface MyInterface {
|
||||
>MyInterface : Symbol(MyInterface, Decl(mappedTypePartialConstraints.ts, 0, 0))
|
||||
|
||||
something: number;
|
||||
>something : Symbol(MyInterface.something, Decl(mappedTypePartialConstraints.ts, 2, 23))
|
||||
}
|
||||
|
||||
class MyClass<T extends MyInterface> {
|
||||
>MyClass : Symbol(MyClass, Decl(mappedTypePartialConstraints.ts, 4, 1))
|
||||
>T : Symbol(T, Decl(mappedTypePartialConstraints.ts, 6, 14))
|
||||
>MyInterface : Symbol(MyInterface, Decl(mappedTypePartialConstraints.ts, 0, 0))
|
||||
|
||||
doIt(data : Partial<T>) {}
|
||||
>doIt : Symbol(MyClass.doIt, Decl(mappedTypePartialConstraints.ts, 6, 38))
|
||||
>data : Symbol(data, Decl(mappedTypePartialConstraints.ts, 7, 7))
|
||||
>Partial : Symbol(Partial, Decl(lib.d.ts, --, --))
|
||||
>T : Symbol(T, Decl(mappedTypePartialConstraints.ts, 6, 14))
|
||||
}
|
||||
|
||||
class MySubClass extends MyClass<MyInterface> {}
|
||||
>MySubClass : Symbol(MySubClass, Decl(mappedTypePartialConstraints.ts, 8, 1))
|
||||
>MyClass : Symbol(MyClass, Decl(mappedTypePartialConstraints.ts, 4, 1))
|
||||
>MyInterface : Symbol(MyInterface, Decl(mappedTypePartialConstraints.ts, 0, 0))
|
||||
|
||||
function fn(arg: typeof MyClass) {};
|
||||
>fn : Symbol(fn, Decl(mappedTypePartialConstraints.ts, 10, 48))
|
||||
>arg : Symbol(arg, Decl(mappedTypePartialConstraints.ts, 12, 12))
|
||||
>MyClass : Symbol(MyClass, Decl(mappedTypePartialConstraints.ts, 4, 1))
|
||||
|
||||
fn(MySubClass);
|
||||
>fn : Symbol(fn, Decl(mappedTypePartialConstraints.ts, 10, 48))
|
||||
>MySubClass : Symbol(MySubClass, Decl(mappedTypePartialConstraints.ts, 8, 1))
|
||||
|
||||
37
tests/baselines/reference/mappedTypePartialConstraints.types
Normal file
37
tests/baselines/reference/mappedTypePartialConstraints.types
Normal file
@@ -0,0 +1,37 @@
|
||||
=== tests/cases/compiler/mappedTypePartialConstraints.ts ===
|
||||
// Repro from #16985
|
||||
|
||||
interface MyInterface {
|
||||
>MyInterface : MyInterface
|
||||
|
||||
something: number;
|
||||
>something : number
|
||||
}
|
||||
|
||||
class MyClass<T extends MyInterface> {
|
||||
>MyClass : MyClass<T>
|
||||
>T : T
|
||||
>MyInterface : MyInterface
|
||||
|
||||
doIt(data : Partial<T>) {}
|
||||
>doIt : (data: Partial<T>) => void
|
||||
>data : Partial<T>
|
||||
>Partial : Partial<T>
|
||||
>T : T
|
||||
}
|
||||
|
||||
class MySubClass extends MyClass<MyInterface> {}
|
||||
>MySubClass : MySubClass
|
||||
>MyClass : MyClass<MyInterface>
|
||||
>MyInterface : MyInterface
|
||||
|
||||
function fn(arg: typeof MyClass) {};
|
||||
>fn : (arg: typeof MyClass) => void
|
||||
>arg : typeof MyClass
|
||||
>MyClass : typeof MyClass
|
||||
|
||||
fn(MySubClass);
|
||||
>fn(MySubClass) : void
|
||||
>fn : (arg: typeof MyClass) => void
|
||||
>MySubClass : typeof MySubClass
|
||||
|
||||
15
tests/cases/compiler/mappedTypePartialConstraints.ts
Normal file
15
tests/cases/compiler/mappedTypePartialConstraints.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
// Repro from #16985
|
||||
|
||||
interface MyInterface {
|
||||
something: number;
|
||||
}
|
||||
|
||||
class MyClass<T extends MyInterface> {
|
||||
doIt(data : Partial<T>) {}
|
||||
}
|
||||
|
||||
class MySubClass extends MyClass<MyInterface> {}
|
||||
|
||||
function fn(arg: typeof MyClass) {};
|
||||
|
||||
fn(MySubClass);
|
||||
Reference in New Issue
Block a user