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

Invalid declarations #23

Open
darrachequesne opened this issue Dec 9, 2022 · 2 comments
Open

Invalid declarations #23

darrachequesne opened this issue Dec 9, 2022 · 2 comments

Comments

@darrachequesne
Copy link

Hi! It seems the private attributes are not updated in the declaration file. Do you know if it's possible?

input.ts:

export class Class {
	public publicField: number = 123;
	private privateField: string = 'string-value';

	public constructor() {
		this.privateMethod(this.privateField);
		this.privateMethod(this.publicField);

		this['privateMethod'](this.privateField);
	}

	private privateMethod(a: string | number): void { }
}

output.js:

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

input.d.ts:

export declare class Class {
    publicField: number;
    private privateField;
    constructor();
    private privateMethod;
}
@timocov
Copy link
Owner

timocov commented Dec 13, 2022

Hi there,

Not sure if it is possible (I hope it should?) but at least we should be able to generate source maps for declaration files timocov/ts-transformer-properties-rename#2.

May I ask you why are you using this package over https://github.com/timocov/ts-transformer-properties-rename that can handle more cases than just privates? No pressure, I'm just trying to understand why a reason could be behind :)

@darrachequesne
Copy link
Author

May I ask you why are you using this package over https://github.com/timocov/ts-transformer-properties-rename that can handle more cases than just privates?

That's a good question! I will check whether it covers our use case, thanks 👍

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

No branches or pull requests

2 participants