163 lines
No EOL
5.3 KiB
Text
163 lines
No EOL
5.3 KiB
Text
==== tests/cases/compiler/privacyTypeParametersOfClassDeclFile.ts (4 errors) ====
|
|
class privateClass {
|
|
}
|
|
|
|
export class publicClass {
|
|
}
|
|
|
|
export class publicClassWithPrivateTypeParameters<T extends privateClass> { // Error
|
|
~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! Type parameter 'T' of exported class has or is using private name 'privateClass'.
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
export class publicClassWithPublicTypeParameters<T extends publicClass> {
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
class privateClassWithPrivateTypeParameters<T extends privateClass> {
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
class privateClassWithPublicTypeParameters<T extends publicClass> {
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
export class publicClassWithPublicTypeParametersWithoutExtends<T> {
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
class privateClassWithPublicTypeParametersWithoutExtends<T> {
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
export class publicClassWithTypeParametersFromPrivateModule<T extends privateModule.publicClassInPrivateModule> { // Error
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! Type parameter 'T' of exported class has or is using name 'privateModule.publicClassInPrivateModule' from private module 'privateModule'.
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
class privateClassWithTypeParametersFromPrivateModule<T extends privateModule.publicClassInPrivateModule> {
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
export module publicModule {
|
|
class privateClassInPublicModule {
|
|
}
|
|
|
|
export class publicClassInPublicModule {
|
|
}
|
|
|
|
export class publicClassWithPrivateTypeParameters<T extends privateClassInPublicModule> { // Error
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! Type parameter 'T' of exported class has or is using private name 'privateClassInPublicModule'.
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
export class publicClassWithPublicTypeParameters<T extends publicClassInPublicModule> {
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
class privateClassWithPrivateTypeParameters<T extends privateClassInPublicModule> {
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
class privateClassWithPublicTypeParameters<T extends publicClassInPublicModule> {
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
export class publicClassWithPublicTypeParametersWithoutExtends<T> {
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
class privateClassWithPublicTypeParametersWithoutExtends<T> {
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
export class publicClassWithTypeParametersFromPrivateModule<T extends privateModule.publicClassInPrivateModule> { // Error
|
|
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
|
!!! Type parameter 'T' of exported class has or is using name 'privateModule.publicClassInPrivateModule' from private module 'privateModule'.
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
class privateClassWithTypeParametersFromPrivateModule<T extends privateModule.publicClassInPrivateModule> {
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
}
|
|
|
|
module privateModule {
|
|
class privateClassInPrivateModule {
|
|
}
|
|
|
|
export class publicClassInPrivateModule {
|
|
}
|
|
|
|
export class publicClassWithPrivateTypeParameters<T extends privateClassInPrivateModule> {
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
export class publicClassWithPublicTypeParameters<T extends publicClassInPrivateModule> {
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
class privateClassWithPrivateTypeParameters<T extends privateClassInPrivateModule> {
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
class privateClassWithPublicTypeParameters<T extends publicClassInPrivateModule> {
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
export class publicClassWithPublicTypeParametersWithoutExtends<T> {
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
|
|
class privateClassWithPublicTypeParametersWithoutExtends<T> {
|
|
myMethod(val: T): T {
|
|
return val;
|
|
}
|
|
}
|
|
}
|
|
|