node.js syntax checker bug about shadowing in private fields 0 ▲ Christian Fei 155 days ago · Tech · hide · Fediverse post node.js syntax checker bug about shadowing in private fields2026-06-24 · ChrisFinally understood an issue I was encountering, that in my opinion is a bug and super confusing and deceptive.SyntaxError: Private field must be declared in an enclosing class The gist is the following: let's say you declared a class and have a private field (#somePrivateMethod) there.class Example { #somePrivateMethod(param1) {} } node --check reports 👌 so all good so far.The issue arises when you write a very specific typo inside #somePrivateMethod, namely shadowing the private method parameters.e.g.class Example { someInstanceMethod () { this.#somePrivateMethod('test') } #somePrivateMethod(param1) { // unintentional shadowing through typo or clanker const param1 = '...' } } node --check now will report the following:tmp.js:3 this.#somePrivateMethod('test') ^ SyntaxError: Private field '#somePrivateMethod' must be declared in an enclosing class at wrapSafe (node:internal/modules/cjs/loader:1806:18) at… Commenting on Bubbles has been removed. Why? If you want to talk about this post, write to the author, use the comments on their blog if it has them, or reply with a "RE:" post on your own blog. Suggestions? feedback@bubbles.town