TypeScript/tests/baselines/reference/wrappedAndRecursiveConstraints.types

52 lines
763 B
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/conformance/types/typeParameters/typeArgumentLists/wrappedAndRecursiveConstraints.ts ===
// no errors expected
class C<T extends Date> {
>C : C<T>
>T : T
>Date : Date
2014-08-15 23:33:16 +02:00
constructor(public data: T) { }
>data : T
>T : T
2014-08-15 23:33:16 +02:00
foo<U extends T>(x: U) {
>foo : <U extends T>(x: U) => U
>U : U
>T : T
>x : U
>U : U
2014-08-15 23:33:16 +02:00
return x;
>x : U
2014-08-15 23:33:16 +02:00
}
}
interface Foo extends Date {
>Foo : Foo
>Date : Date
2014-08-15 23:33:16 +02:00
foo: string;
>foo : string
2014-08-15 23:33:16 +02:00
}
var y: Foo = null;
>y : Foo
>Foo : Foo
2015-04-13 21:36:11 +02:00
>null : null
2014-08-15 23:33:16 +02:00
var c = new C(y);
>c : C<Foo>
2014-08-15 23:33:16 +02:00
>new C(y) : C<Foo>
>C : typeof C
>y : Foo
2014-08-15 23:33:16 +02:00
var r = c.foo(y);
>r : Foo
2014-08-15 23:33:16 +02:00
>c.foo(y) : Foo
>c.foo : <U extends Foo>(x: U) => U
>c : C<Foo>
>foo : <U extends Foo>(x: U) => U
>y : Foo
2014-08-15 23:33:16 +02:00