-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed handling private fields with
declare
keyword
Fixes #24
- Loading branch information
Showing
5 changed files
with
68 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
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
9 changes: 9 additions & 0 deletions
9
tests/test-cases/useDefineForClassFields-and-declare/input.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,9 @@ | ||
class Class { | ||
public declare publicField: number; | ||
protected declare protectedField: number; | ||
private declare privateField: number; | ||
|
||
public method() { | ||
console.log(this.publicField, this.protectedField, this.privateField); | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
tests/test-cases/useDefineForClassFields-and-declare/output.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,13 @@ | ||
var Class = /** @class */ (function () { | ||
function Class() { | ||
} | ||
Object.defineProperty(Class.prototype, "method", { | ||
enumerable: false, | ||
configurable: true, | ||
writable: true, | ||
value: function () { | ||
console.log(this.publicField, this.protectedField, this.privateField); | ||
} | ||
}); | ||
return Class; | ||
}()); |
6 changes: 6 additions & 0 deletions
6
tests/test-cases/useDefineForClassFields-and-declare/tsconfig.json
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,6 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es5", | ||
"useDefineForClassFields": true | ||
} | ||
} |