104 lines
2.2 KiB
Text
104 lines
2.2 KiB
Text
=== tests/cases/compiler/privacyTypeParametersOfClass.ts ===
|
|
class privateClass {
|
|
>privateClass : privateClass
|
|
}
|
|
|
|
export class publicClass {
|
|
>publicClass : publicClass
|
|
}
|
|
|
|
// TypeParameter_0_of_exported_class_1_has_or_is_using_private_type_2
|
|
export class publicClassWithPrivateTypeParameters<T extends privateClass> {
|
|
>publicClassWithPrivateTypeParameters : publicClassWithPrivateTypeParameters<T>
|
|
>T : T
|
|
>privateClass : privateClass
|
|
|
|
myMethod(val: T): T { // Error
|
|
>myMethod : (val: T) => T
|
|
>val : T
|
|
>T : T
|
|
>T : T
|
|
|
|
return val;
|
|
>val : T
|
|
}
|
|
}
|
|
|
|
export class publicClassWithPublicTypeParameters<T extends publicClass> {
|
|
>publicClassWithPublicTypeParameters : publicClassWithPublicTypeParameters<T>
|
|
>T : T
|
|
>publicClass : publicClass
|
|
|
|
myMethod(val: T): T { // No Error
|
|
>myMethod : (val: T) => T
|
|
>val : T
|
|
>T : T
|
|
>T : T
|
|
|
|
return val;
|
|
>val : T
|
|
}
|
|
}
|
|
|
|
class privateClassWithPrivateTypeParameters<T extends privateClass> {
|
|
>privateClassWithPrivateTypeParameters : privateClassWithPrivateTypeParameters<T>
|
|
>T : T
|
|
>privateClass : privateClass
|
|
|
|
myMethod(val: T): T { // No Error
|
|
>myMethod : (val: T) => T
|
|
>val : T
|
|
>T : T
|
|
>T : T
|
|
|
|
return val;
|
|
>val : T
|
|
}
|
|
}
|
|
|
|
class privateClassWithPublicTypeParameters<T extends publicClass> {
|
|
>privateClassWithPublicTypeParameters : privateClassWithPublicTypeParameters<T>
|
|
>T : T
|
|
>publicClass : publicClass
|
|
|
|
myMethod(val: T): T { // No Error
|
|
>myMethod : (val: T) => T
|
|
>val : T
|
|
>T : T
|
|
>T : T
|
|
|
|
return val;
|
|
>val : T
|
|
}
|
|
}
|
|
|
|
export class publicClassWithPublicTypeParametersWithoutExtends<T> {
|
|
>publicClassWithPublicTypeParametersWithoutExtends : publicClassWithPublicTypeParametersWithoutExtends<T>
|
|
>T : T
|
|
|
|
myMethod(val: T): T { // No Error
|
|
>myMethod : (val: T) => T
|
|
>val : T
|
|
>T : T
|
|
>T : T
|
|
|
|
return val;
|
|
>val : T
|
|
}
|
|
}
|
|
|
|
class privateClassWithPublicTypeParametersWithoutExtends<T> {
|
|
>privateClassWithPublicTypeParametersWithoutExtends : privateClassWithPublicTypeParametersWithoutExtends<T>
|
|
>T : T
|
|
|
|
myMethod(val: T): T { // No Error
|
|
>myMethod : (val: T) => T
|
|
>val : T
|
|
>T : T
|
|
>T : T
|
|
|
|
return val;
|
|
>val : T
|
|
}
|
|
}
|
|
|