mirror of
https://github.com/hanzoai/tsgo.git
synced 2026-10-30 19:37:15 +00:00
35 lines
651 B
TypeScript
35 lines
651 B
TypeScript
//// [tests/cases/conformance/types/typeParameters/typeArgumentLists/wrappedAndRecursiveConstraints.ts] ////
|
|
|
|
//// [wrappedAndRecursiveConstraints.ts]
|
|
// no errors expected
|
|
|
|
class C<T extends Date> {
|
|
constructor(public data: T) { }
|
|
foo<U extends T>(x: U) {
|
|
return x;
|
|
}
|
|
}
|
|
|
|
interface Foo extends Date {
|
|
foo: string;
|
|
}
|
|
|
|
var y: Foo = {} as Foo;
|
|
var c = new C(y);
|
|
var r = c.foo(y);
|
|
|
|
//// [wrappedAndRecursiveConstraints.js]
|
|
"use strict";
|
|
// no errors expected
|
|
class C {
|
|
constructor(data) {
|
|
this.data = data;
|
|
}
|
|
foo(x) {
|
|
return x;
|
|
}
|
|
}
|
|
var y = {};
|
|
var c = new C(y);
|
|
var r = c.foo(y);
|