forked from microsoft/TypeScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check privateness when emittign readonly/const props (microsoft#26920)
- Loading branch information
Showing
5 changed files
with
77 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
tests/baselines/reference/declarationEmitPrivateReadonlyLiterals.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
//// [declarationEmitPrivateReadonlyLiterals.ts] | ||
class Foo { | ||
private static readonly A = "a"; | ||
private readonly B = "b"; | ||
private static readonly C = 42; | ||
private readonly D = 42; | ||
} | ||
|
||
|
||
//// [declarationEmitPrivateReadonlyLiterals.js] | ||
var Foo = /** @class */ (function () { | ||
function Foo() { | ||
this.B = "b"; | ||
this.D = 42; | ||
} | ||
Foo.A = "a"; | ||
Foo.C = 42; | ||
return Foo; | ||
}()); | ||
|
||
|
||
//// [declarationEmitPrivateReadonlyLiterals.d.ts] | ||
declare class Foo { | ||
private static readonly A; | ||
private readonly B; | ||
private static readonly C; | ||
private readonly D; | ||
} |
17 changes: 17 additions & 0 deletions
17
tests/baselines/reference/declarationEmitPrivateReadonlyLiterals.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
=== tests/cases/compiler/declarationEmitPrivateReadonlyLiterals.ts === | ||
class Foo { | ||
>Foo : Symbol(Foo, Decl(declarationEmitPrivateReadonlyLiterals.ts, 0, 0)) | ||
|
||
private static readonly A = "a"; | ||
>A : Symbol(Foo.A, Decl(declarationEmitPrivateReadonlyLiterals.ts, 0, 11)) | ||
|
||
private readonly B = "b"; | ||
>B : Symbol(Foo.B, Decl(declarationEmitPrivateReadonlyLiterals.ts, 1, 36)) | ||
|
||
private static readonly C = 42; | ||
>C : Symbol(Foo.C, Decl(declarationEmitPrivateReadonlyLiterals.ts, 2, 29)) | ||
|
||
private readonly D = 42; | ||
>D : Symbol(Foo.D, Decl(declarationEmitPrivateReadonlyLiterals.ts, 3, 35)) | ||
} | ||
|
21 changes: 21 additions & 0 deletions
21
tests/baselines/reference/declarationEmitPrivateReadonlyLiterals.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
=== tests/cases/compiler/declarationEmitPrivateReadonlyLiterals.ts === | ||
class Foo { | ||
>Foo : Foo | ||
|
||
private static readonly A = "a"; | ||
>A : "a" | ||
>"a" : "a" | ||
|
||
private readonly B = "b"; | ||
>B : "b" | ||
>"b" : "b" | ||
|
||
private static readonly C = 42; | ||
>C : 42 | ||
>42 : 42 | ||
|
||
private readonly D = 42; | ||
>D : 42 | ||
>42 : 42 | ||
} | ||
|
8 changes: 8 additions & 0 deletions
8
tests/cases/compiler/declarationEmitPrivateReadonlyLiterals.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
// @declaration: true | ||
|
||
class Foo { | ||
private static readonly A = "a"; | ||
private readonly B = "b"; | ||
private static readonly C = 42; | ||
private readonly D = 42; | ||
} |