2014-08-15 23:33:16 +02:00
|
|
|
=== tests/cases/compiler/privacyTypeParametersOfInterface.ts ===
|
|
|
|
class privateClass {
|
|
|
|
>privateClass : privateClass
|
|
|
|
}
|
|
|
|
|
|
|
|
export class publicClass {
|
|
|
|
>publicClass : publicClass
|
|
|
|
}
|
|
|
|
|
|
|
|
class privateClassT<T> {
|
|
|
|
>privateClassT : privateClassT<T>
|
|
|
|
>T : T
|
|
|
|
}
|
|
|
|
|
|
|
|
export class publicClassT<T> {
|
|
|
|
>publicClassT : publicClassT<T>
|
|
|
|
>T : T
|
|
|
|
}
|
|
|
|
|
|
|
|
// TypeParameter_0_of_exported_interface_1_has_or_is_using_private_type_2
|
|
|
|
export interface publicInterfaceWithPrivateTypeParameters<T extends privateClass> {
|
|
|
|
>publicInterfaceWithPrivateTypeParameters : publicInterfaceWithPrivateTypeParameters<T>
|
|
|
|
>T : T
|
|
|
|
>privateClass : privateClass
|
|
|
|
|
|
|
|
myMethod(val: T): T; // Error
|
|
|
|
>myMethod : (val: T) => T
|
|
|
|
>val : T
|
|
|
|
>T : T
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
myMethod0(): publicClassT<T>; // error
|
|
|
|
>myMethod0 : () => publicClassT<T>
|
2014-08-19 04:56:03 +02:00
|
|
|
>publicClassT : publicClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
|
|
|
|
myMethod1(): privateClassT<privateClass>; // error
|
|
|
|
>myMethod1 : () => privateClassT<privateClass>
|
2014-08-19 04:56:03 +02:00
|
|
|
>privateClassT : privateClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>privateClass : privateClass
|
|
|
|
|
|
|
|
myMethod2(): privateClassT<publicClass>; // error
|
|
|
|
>myMethod2 : () => privateClassT<publicClass>
|
2014-08-19 04:56:03 +02:00
|
|
|
>privateClassT : privateClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>publicClass : publicClass
|
|
|
|
|
|
|
|
myMethod3(): publicClassT<privateClass>; //error
|
|
|
|
>myMethod3 : () => publicClassT<privateClass>
|
2014-08-19 04:56:03 +02:00
|
|
|
>publicClassT : publicClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>privateClass : privateClass
|
|
|
|
|
|
|
|
myMethod4(): publicClassT<publicClass>; // no error
|
|
|
|
>myMethod4 : () => publicClassT<publicClass>
|
2014-08-19 04:56:03 +02:00
|
|
|
>publicClassT : publicClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>publicClass : publicClass
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface publicInterfaceWithPublicTypeParameters<T extends publicClass> {
|
|
|
|
>publicInterfaceWithPublicTypeParameters : publicInterfaceWithPublicTypeParameters<T>
|
|
|
|
>T : T
|
|
|
|
>publicClass : publicClass
|
|
|
|
|
|
|
|
myMethod(val: T): T; // No Error
|
|
|
|
>myMethod : (val: T) => T
|
|
|
|
>val : T
|
|
|
|
>T : T
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
myMethod0(): publicClassT<T>; // No error
|
|
|
|
>myMethod0 : () => publicClassT<T>
|
2014-08-19 04:56:03 +02:00
|
|
|
>publicClassT : publicClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
|
|
|
|
myMethod1(): privateClassT<privateClass>; // error
|
|
|
|
>myMethod1 : () => privateClassT<privateClass>
|
2014-08-19 04:56:03 +02:00
|
|
|
>privateClassT : privateClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>privateClass : privateClass
|
|
|
|
|
|
|
|
myMethod2(): privateClassT<publicClass>; // error
|
|
|
|
>myMethod2 : () => privateClassT<publicClass>
|
2014-08-19 04:56:03 +02:00
|
|
|
>privateClassT : privateClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>publicClass : publicClass
|
|
|
|
|
|
|
|
myMethod3(): publicClassT<privateClass>; //error
|
|
|
|
>myMethod3 : () => publicClassT<privateClass>
|
2014-08-19 04:56:03 +02:00
|
|
|
>publicClassT : publicClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>privateClass : privateClass
|
|
|
|
|
|
|
|
myMethod4(): publicClassT<publicClass>; // no error
|
|
|
|
>myMethod4 : () => publicClassT<publicClass>
|
2014-08-19 04:56:03 +02:00
|
|
|
>publicClassT : publicClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>publicClass : publicClass
|
|
|
|
}
|
|
|
|
|
|
|
|
interface privateInterfaceWithPrivateTypeParameters<T extends privateClass> {
|
|
|
|
>privateInterfaceWithPrivateTypeParameters : privateInterfaceWithPrivateTypeParameters<T>
|
|
|
|
>T : T
|
|
|
|
>privateClass : privateClass
|
|
|
|
|
|
|
|
myMethod(val: T): T; // No Error
|
|
|
|
>myMethod : (val: T) => T
|
|
|
|
>val : T
|
|
|
|
>T : T
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
myMethod0(): publicClassT<T>; // No error
|
|
|
|
>myMethod0 : () => publicClassT<T>
|
2014-08-19 04:56:03 +02:00
|
|
|
>publicClassT : publicClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
|
|
|
|
myMethod1(): privateClassT<privateClass>; // No error
|
|
|
|
>myMethod1 : () => privateClassT<privateClass>
|
2014-08-19 04:56:03 +02:00
|
|
|
>privateClassT : privateClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>privateClass : privateClass
|
|
|
|
|
|
|
|
myMethod2(): privateClassT<publicClass>; // No error
|
|
|
|
>myMethod2 : () => privateClassT<publicClass>
|
2014-08-19 04:56:03 +02:00
|
|
|
>privateClassT : privateClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>publicClass : publicClass
|
|
|
|
|
|
|
|
myMethod3(): publicClassT<privateClass>; //No error
|
|
|
|
>myMethod3 : () => publicClassT<privateClass>
|
2014-08-19 04:56:03 +02:00
|
|
|
>publicClassT : publicClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>privateClass : privateClass
|
|
|
|
|
|
|
|
myMethod4(): publicClassT<publicClass>; // no error
|
|
|
|
>myMethod4 : () => publicClassT<publicClass>
|
2014-08-19 04:56:03 +02:00
|
|
|
>publicClassT : publicClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>publicClass : publicClass
|
|
|
|
}
|
|
|
|
|
|
|
|
interface privateInterfaceWithPublicTypeParameters<T extends publicClass> {
|
|
|
|
>privateInterfaceWithPublicTypeParameters : privateInterfaceWithPublicTypeParameters<T>
|
|
|
|
>T : T
|
|
|
|
>publicClass : publicClass
|
|
|
|
|
|
|
|
myMethod(val: T): T; // No Error
|
|
|
|
>myMethod : (val: T) => T
|
|
|
|
>val : T
|
|
|
|
>T : T
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
myMethod0(): publicClassT<T>; // No error
|
|
|
|
>myMethod0 : () => publicClassT<T>
|
2014-08-19 04:56:03 +02:00
|
|
|
>publicClassT : publicClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
|
|
|
|
myMethod1(): privateClassT<privateClass>; // No error
|
|
|
|
>myMethod1 : () => privateClassT<privateClass>
|
2014-08-19 04:56:03 +02:00
|
|
|
>privateClassT : privateClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>privateClass : privateClass
|
|
|
|
|
|
|
|
myMethod2(): privateClassT<publicClass>; // No error
|
|
|
|
>myMethod2 : () => privateClassT<publicClass>
|
2014-08-19 04:56:03 +02:00
|
|
|
>privateClassT : privateClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>publicClass : publicClass
|
|
|
|
|
|
|
|
myMethod3(): publicClassT<privateClass>; //No error
|
|
|
|
>myMethod3 : () => publicClassT<privateClass>
|
2014-08-19 04:56:03 +02:00
|
|
|
>publicClassT : publicClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>privateClass : privateClass
|
|
|
|
|
|
|
|
myMethod4(): publicClassT<publicClass>; // no error
|
|
|
|
>myMethod4 : () => publicClassT<publicClass>
|
2014-08-19 04:56:03 +02:00
|
|
|
>publicClassT : publicClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>publicClass : publicClass
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface publicInterfaceWithPublicTypeParametersWithoutExtends<T> {
|
|
|
|
>publicInterfaceWithPublicTypeParametersWithoutExtends : publicInterfaceWithPublicTypeParametersWithoutExtends<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
myMethod(val: T): T; // No Error
|
|
|
|
>myMethod : (val: T) => T
|
|
|
|
>val : T
|
|
|
|
>T : T
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
myMethod0(): publicClassT<T>; // No error
|
|
|
|
>myMethod0 : () => publicClassT<T>
|
2014-08-19 04:56:03 +02:00
|
|
|
>publicClassT : publicClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
}
|
|
|
|
|
|
|
|
interface privateInterfaceWithPublicTypeParametersWithoutExtends<T> {
|
|
|
|
>privateInterfaceWithPublicTypeParametersWithoutExtends : privateInterfaceWithPublicTypeParametersWithoutExtends<T>
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
myMethod(val: T): T; // No Error
|
|
|
|
>myMethod : (val: T) => T
|
|
|
|
>val : T
|
|
|
|
>T : T
|
|
|
|
>T : T
|
|
|
|
|
|
|
|
myMethod0(): publicClassT<T>; // No error
|
|
|
|
>myMethod0 : () => publicClassT<T>
|
2014-08-19 04:56:03 +02:00
|
|
|
>publicClassT : publicClassT<T>
|
2014-08-15 23:33:16 +02:00
|
|
|
>T : T
|
|
|
|
}
|