-
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.
Skip private members with decorators
- Loading branch information
Pavel Bocharov
committed
Oct 22, 2021
1 parent
7e4dfda
commit 44096a7
Showing
5 changed files
with
54 additions
and
1 deletion.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
export class Class { | ||
public publicField: number = 123; | ||
//@ts-ignore | ||
@decorator private privateField: string = 'string-value'; | ||
|
||
public constructor() { | ||
this.privateMethod(this.privateField); | ||
this.privateMethod(this.publicField); | ||
|
||
this['privateMethod'](this.privateField); | ||
} | ||
|
||
//@ts-ignore | ||
@decorator private privateMethod(a: string | number): void { } | ||
} | ||
|
||
function decorator(target: any, propertyKey: string): void {} |
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,29 @@ | ||
"use strict"; | ||
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) { | ||
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d; | ||
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc); | ||
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r; | ||
return c > 3 && r && Object.defineProperty(target, key, r), r; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var Class = /** @class */ (function () { | ||
function Class() { | ||
this.publicField = 123; | ||
//@ts-ignore | ||
this.privateField = 'string-value'; | ||
this.privateMethod(this.privateField); | ||
this.privateMethod(this.publicField); | ||
this['privateMethod'](this.privateField); | ||
} | ||
//@ts-ignore | ||
Class.prototype.privateMethod = function (a) { }; | ||
__decorate([ | ||
decorator | ||
], Class.prototype, "privateField", void 0); | ||
__decorate([ | ||
decorator | ||
], Class.prototype, "privateMethod", null); | ||
return Class; | ||
}()); | ||
exports.Class = Class; | ||
function decorator(target, propertyKey) { } |