Open phryneas opened 2 years ago
The quick info on that function is a bit wonky:
(method) Test.#assertReady(): asserts this is {
"__#46@#ready": true;
}
Where the number 46
goes up as you edit the document.
The error is intentional. While it may appear to work, this hasn't been designed or tested at all, so there might be dragons lurking, hard to say.
@nmain #36548
Assertion Function "Private identifiers are not allowed outside class bodies."
Bug Report
🔎 Search Terms
assertion function, asserts, #, private members, Private identifiers are not allowed outside class bodies.
🕗 Version & Regression Information
This happens in 4.0.5, 4.4.3, 4.5.4 and the latest nightlies - so probably in all TS versions that support assertion functions and private class members.
⏯ Playground Link
A playground showcasing the problem
💻 Code
🙁 Actual behavior
The code above works 100% as expected (the assertion function also narrows the type of
this.#ready
down totrue
correctly), but TS displays an error message:🙂 Expected behavior
The error message should be removed - this seems to work absolutely fine as it is. The error message seems to be a red herring.