Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct handle or fail build if access to this with runtime-based key #5

Open
timocov opened this issue Mar 31, 2019 · 0 comments
Open
Labels
enhancement New feature or request

Comments

@timocov
Copy link
Owner

timocov commented Mar 31, 2019

input.ts:

export class Class {
	private privateField: string = 'string-value';

	public constructor() {
		const that = this;
		that[Math.random() ? 'privateMethod' : 'publicMethod'](this.privateField);
		this[Math.random() ? 'privateMethod' : 'publicMethod'](this.privateField);
	}

	public publicMethod(): void {

	}

	private privateMethod(a: string): void {

	}
}

output.js:

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var Class = /** @class */ (function () {
    function Class() {
        this._private_privateField = 'string-value';
        var that = this;
        that[Math.random() ? '_private_privateMethod' : 'publicMethod'](this._private_privateField);
        this[Math.random() ? '_private_privateMethod' : 'publicMethod'](this._private_privateField);
    }
    Class.prototype.publicMethod = function () {
    };
    Class.prototype._private_privateMethod = function (a) {
    };
    return Class;
}());
exports.Class = Class;

or fail with error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant