TypeScript/tests/baselines/reference/genericSpecializations1.types

46 lines
846 B
Plaintext
Raw Normal View History

2014-08-15 23:33:16 +02:00
=== tests/cases/compiler/genericSpecializations1.ts ===
interface IFoo<T> {
>IFoo : IFoo<T>
>T : T
2014-08-15 23:33:16 +02:00
foo<T>(x: T): T; // no error on implementors because IFoo's T is different from foo's T
>foo : <T>(x: T) => T
>T : T
>x : T
>T : T
>T : T
2014-08-15 23:33:16 +02:00
}
class IntFooBad implements IFoo<number> {
>IntFooBad : IntFooBad
>IFoo : IFoo<T>
2014-08-15 23:33:16 +02:00
foo(x: string): string { return null; }
>foo : (x: string) => string
>x : string
2015-04-13 21:36:11 +02:00
>null : null
2014-08-15 23:33:16 +02:00
}
class StringFoo2 implements IFoo<string> {
>StringFoo2 : StringFoo2
>IFoo : IFoo<T>
2014-08-15 23:33:16 +02:00
foo(x: string): string { return null; }
>foo : (x: string) => string
>x : string
2015-04-13 21:36:11 +02:00
>null : null
2014-08-15 23:33:16 +02:00
}
class StringFoo3 implements IFoo<string> {
>StringFoo3 : StringFoo3
>IFoo : IFoo<T>
2014-08-15 23:33:16 +02:00
foo<T>(x: T): T { return null; }
>foo : <T>(x: T) => T
>T : T
>x : T
>T : T
>T : T
2015-04-13 21:36:11 +02:00
>null : null
2014-08-15 23:33:16 +02:00
}