Skip to content
JS
JavaScript error

SyntaxError

The JavaScript exception "reference to undeclared private field or method #x" occurs when a private name is used, but this private name is not declared in the class scope.

Reference entryJavaScriptFetched
SyntaxError: Private field '#x' must be declared in an enclosing class (V8-based)
As listed by MDN Web Docs
SyntaxError: reference to undeclared private field or method #x (Firefox)
As listed by MDN Web Docs
SyntaxError: Cannot reference undeclared private names: "#x" (Safari)
As listed by MDN Web Docs
Category
SyntaxError
Severity
error
Runtime
both
or press Cmd/Ctrl + Enter. The text is only sent to this site to match it.
Source: MDN Web Docs. Data fetched 2026-09-25T01:48:37.274Z.