mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-05 08:11:30 -06:00
Test case for visibility error in the type literal
This commit is contained in:
parent
c7bd7c9557
commit
acff59f029
@ -0,0 +1,91 @@
|
||||
tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(11,12): error TS4025: Exported variable 'x' has or is using private name 'private1'.
|
||||
tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(12,12): error TS4025: Exported variable 'x' has or is using private name 'm2'.
|
||||
tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(13,13): error TS4025: Exported variable 'x' has or is using private name 'm2'.
|
||||
tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(14,19): error TS4025: Exported variable 'x' has or is using private name 'private1'.
|
||||
tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(15,22): error TS4025: Exported variable 'x' has or is using private name 'private1'.
|
||||
tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(16,22): error TS4025: Exported variable 'x' has or is using private name 'm2'.
|
||||
tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(18,16): error TS4024: Exported variable 'x2' has or is using name 'm2.public1' from private module 'm2'.
|
||||
tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(18,16): error TS4025: Exported variable 'x2' has or is using private name 'private1'.
|
||||
tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(25,16): error TS4024: Exported variable 'x3' has or is using name 'm2.public1' from private module 'm2'.
|
||||
tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(25,16): error TS4025: Exported variable 'x3' has or is using private name 'private1'.
|
||||
tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(28,23): error TS4025: Exported variable 'y' has or is using private name 'private1'.
|
||||
tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(28,36): error TS4025: Exported variable 'y' has or is using private name 'm2'.
|
||||
tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(29,16): error TS4024: Exported variable 'y2' has or is using name 'm2.public1' from private module 'm2'.
|
||||
tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(29,16): error TS4025: Exported variable 'y2' has or is using private name 'private1'.
|
||||
tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(32,27): error TS4025: Exported variable 'z' has or is using private name 'private1'.
|
||||
tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(32,40): error TS4025: Exported variable 'z' has or is using private name 'm2'.
|
||||
tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(33,16): error TS4024: Exported variable 'z2' has or is using name 'm2.public1' from private module 'm2'.
|
||||
tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts(33,16): error TS4025: Exported variable 'z2' has or is using private name 'private1'.
|
||||
|
||||
|
||||
==== tests/cases/compiler/declFileTypeAnnotationVisibilityErrorTypeLiteral.ts (18 errors) ====
|
||||
|
||||
module m {
|
||||
class private1 {
|
||||
}
|
||||
module m2 {
|
||||
export class public1 {
|
||||
}
|
||||
}
|
||||
|
||||
export var x: {
|
||||
x: private1;
|
||||
~~~~~~~~
|
||||
!!! error TS4025: Exported variable 'x' has or is using private name 'private1'.
|
||||
y: m2.public1;
|
||||
~~~~~~~~~~
|
||||
!!! error TS4025: Exported variable 'x' has or is using private name 'm2'.
|
||||
(): m2.public1[];
|
||||
~~~~~~~~~~
|
||||
!!! error TS4025: Exported variable 'x' has or is using private name 'm2'.
|
||||
method(): private1;
|
||||
~~~~~~~~
|
||||
!!! error TS4025: Exported variable 'x' has or is using private name 'private1'.
|
||||
[n: number]: private1;
|
||||
~~~~~~~~
|
||||
!!! error TS4025: Exported variable 'x' has or is using private name 'private1'.
|
||||
[s: string]: m2.public1;
|
||||
~~~~~~~~~~
|
||||
!!! error TS4025: Exported variable 'x' has or is using private name 'm2'.
|
||||
};
|
||||
export var x2 = {
|
||||
~~
|
||||
!!! error TS4024: Exported variable 'x2' has or is using name 'm2.public1' from private module 'm2'.
|
||||
~~
|
||||
!!! error TS4025: Exported variable 'x2' has or is using private name 'private1'.
|
||||
x: new private1(),
|
||||
y: new m2.public1(),
|
||||
method() {
|
||||
return new private1();
|
||||
}
|
||||
};
|
||||
export var x3 = x;
|
||||
~~
|
||||
!!! error TS4024: Exported variable 'x3' has or is using name 'm2.public1' from private module 'm2'.
|
||||
~~
|
||||
!!! error TS4025: Exported variable 'x3' has or is using private name 'private1'.
|
||||
|
||||
// Function type
|
||||
export var y: (a: private1) => m2.public1;
|
||||
~~~~~~~~
|
||||
!!! error TS4025: Exported variable 'y' has or is using private name 'private1'.
|
||||
~~~~~~~~~~
|
||||
!!! error TS4025: Exported variable 'y' has or is using private name 'm2'.
|
||||
export var y2 = y;
|
||||
~~
|
||||
!!! error TS4024: Exported variable 'y2' has or is using name 'm2.public1' from private module 'm2'.
|
||||
~~
|
||||
!!! error TS4025: Exported variable 'y2' has or is using private name 'private1'.
|
||||
|
||||
// constructor type
|
||||
export var z: new (a: private1) => m2.public1;
|
||||
~~~~~~~~
|
||||
!!! error TS4025: Exported variable 'z' has or is using private name 'private1'.
|
||||
~~~~~~~~~~
|
||||
!!! error TS4025: Exported variable 'z' has or is using private name 'm2'.
|
||||
export var z2 = z;
|
||||
~~
|
||||
!!! error TS4024: Exported variable 'z2' has or is using name 'm2.public1' from private module 'm2'.
|
||||
~~
|
||||
!!! error TS4025: Exported variable 'z2' has or is using private name 'private1'.
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
//// [declFileTypeAnnotationVisibilityErrorTypeLiteral.ts]
|
||||
|
||||
module m {
|
||||
class private1 {
|
||||
}
|
||||
module m2 {
|
||||
export class public1 {
|
||||
}
|
||||
}
|
||||
|
||||
export var x: {
|
||||
x: private1;
|
||||
y: m2.public1;
|
||||
(): m2.public1[];
|
||||
method(): private1;
|
||||
[n: number]: private1;
|
||||
[s: string]: m2.public1;
|
||||
};
|
||||
export var x2 = {
|
||||
x: new private1(),
|
||||
y: new m2.public1(),
|
||||
method() {
|
||||
return new private1();
|
||||
}
|
||||
};
|
||||
export var x3 = x;
|
||||
|
||||
// Function type
|
||||
export var y: (a: private1) => m2.public1;
|
||||
export var y2 = y;
|
||||
|
||||
// constructor type
|
||||
export var z: new (a: private1) => m2.public1;
|
||||
export var z2 = z;
|
||||
}
|
||||
|
||||
//// [declFileTypeAnnotationVisibilityErrorTypeLiteral.js]
|
||||
var m;
|
||||
(function (m) {
|
||||
var private1 = (function () {
|
||||
function private1() {
|
||||
}
|
||||
return private1;
|
||||
})();
|
||||
var m2;
|
||||
(function (m2) {
|
||||
var public1 = (function () {
|
||||
function public1() {
|
||||
}
|
||||
return public1;
|
||||
})();
|
||||
m2.public1 = public1;
|
||||
})(m2 || (m2 = {}));
|
||||
m.x;
|
||||
m.x2 = {
|
||||
x: new private1(),
|
||||
y: new m2.public1(),
|
||||
method: function () {
|
||||
return new private1();
|
||||
}
|
||||
};
|
||||
m.x3 = m.x;
|
||||
// Function type
|
||||
m.y;
|
||||
m.y2 = m.y;
|
||||
// constructor type
|
||||
m.z;
|
||||
m.z2 = m.z;
|
||||
})(m || (m = {}));
|
||||
@ -0,0 +1,37 @@
|
||||
// @target: ES5
|
||||
// @module: commonjs
|
||||
// @declaration: true
|
||||
|
||||
module m {
|
||||
class private1 {
|
||||
}
|
||||
module m2 {
|
||||
export class public1 {
|
||||
}
|
||||
}
|
||||
|
||||
export var x: {
|
||||
x: private1;
|
||||
y: m2.public1;
|
||||
(): m2.public1[];
|
||||
method(): private1;
|
||||
[n: number]: private1;
|
||||
[s: string]: m2.public1;
|
||||
};
|
||||
export var x2 = {
|
||||
x: new private1(),
|
||||
y: new m2.public1(),
|
||||
method() {
|
||||
return new private1();
|
||||
}
|
||||
};
|
||||
export var x3 = x;
|
||||
|
||||
// Function type
|
||||
export var y: (a: private1) => m2.public1;
|
||||
export var y2 = y;
|
||||
|
||||
// constructor type
|
||||
export var z: new (a: private1) => m2.public1;
|
||||
export var z2 = z;
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user