feat: support typeof on #private Fields#2174
Conversation
|
We're reverting the linked change in TS, so you probably want to revert it too. |
|
I think it should be ok to leave it in. The only purpose of parsing these types is to strip them, not to validate them. It's harmless if esbuild strips types that TypeScript considers a syntax error. Developers will just see the error from TypeScript and fix their code. The only harm would come if esbuild's type parser somehow behaved differently than TypeScript's type parser regarding which text is considered to be part of the type, which could happen with different ASI rules. But I don't believe that can happen here. It also sounds like this feature may be added back in the future in which case esbuild wouldn't need any further updates to support it. That said, this case is probably a good reason for esbuild to ignore PRs for features in beta versions of TypeScript in the future. |
|
That's true; I was just bulk notifying anyone who mentioned the PR. esbuild definitely wouldn't care about stuff after the colon for emit's sake. Breaks like this should be rare, we just didn't notice it thanks to an inconvenient type cast. |
TypeScript 4.7 now allows us to perform
typeofqueries on private fields.