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

Parser error not clear about private attributes #14236

Open
berzinv opened this issue Sep 29, 2024 · 1 comment
Open

Parser error not clear about private attributes #14236

berzinv opened this issue Sep 29, 2024 · 1 comment
Labels
bug Something isn't working transpiler parser || printer

Comments

@berzinv
Copy link

berzinv commented Sep 29, 2024

What version of Bun is running?

1.1.29

What platform is your computer?

Windows

What steps can reproduce the bug?

class Points {
#points: Array;

constructor(points: Array<Number>) {
	this.#points = points;
}

length() {
	return this.#points.length;
}

}

let p = new Points([1, 2, 3]);
console.log(p.length());
console.log(p.#points);

/* The error I get is
15 | console.log(p.#points);
^
error: Expected identifier but found "#points"
at C:\Users\berzi\Documents\testpoints.ts:15:15

15 | console.log(p.#points);
^
error: Expected ")" but found ";"
at C:\Users\berzi\Documents\testpoints.ts:15:23

Bun v1.1.29 (Windows x64)

*/

What is the expected behavior?

With tsc, the error is very clear

testpoints.ts:15:15 - error TS18013: Property '#points' is not accessible outside class 'Points' because it has a private identifier.

15 console.log(p.#points);
~~~~~~~

Found 1 error in testpoints.ts:15

What do you see instead?

No response

Additional information

No response

@berzinv berzinv added bug Something isn't working typescript Something for TypeScript labels Sep 29, 2024
@Jarred-Sumner
Copy link
Collaborator

yeah this error is not good

@Jarred-Sumner Jarred-Sumner changed the title Error not clear about private attributes Parser error not clear about private attributes Sep 29, 2024
@Jarred-Sumner Jarred-Sumner added transpiler parser || printer and removed typescript Something for TypeScript labels Sep 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working transpiler parser || printer
Projects
None yet
Development

No branches or pull requests

2 participants