-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Avoid stripping declare = … assignments in TS/TSX parsing #25318
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
base: main
Are you sure you want to change the base?
Avoid stripping declare = … assignments in TS/TSX parsing #25318
Conversation
WalkthroughAdds validation in the TypeScript "declare" ambient modifier parsing flow to inspect the next token. If "declare" is followed by declaration keywords (var, let, const, function, class, enum, import, namespace, module, global, abstract, interface, type), it proceeds as ambient declaration; otherwise, "declare" falls back to being treated as a plain identifier. Changes
Possibly related PRs
Suggested reviewers
Pre-merge checks✅ Passed checks (2 passed)
📜 Recent review detailsConfiguration used: Path: .coderabbit.yaml Review profile: ASSERTIVE Plan: Pro Disabled knowledge base sources:
📒 Files selected for processing (1)
🧰 Additional context used📓 Path-based instructions (3)src/**/*.{cpp,zig}📄 CodeRabbit inference engine (.cursor/rules/building-bun.mdc)
Files:
src/**/*.zig📄 CodeRabbit inference engine (.cursor/rules/building-bun.mdc)
Files:
**/*.zig📄 CodeRabbit inference engine (.cursor/rules/zig-javascriptcore-classes.mdc)
Files:
🧠 Learnings (2)📓 Common learnings📚 Learning: 2025-11-24T18:36:38.104ZApplied to files:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
What does this PR do?
namespace/module/global/abstract/interface/type). Otherwise declare remains a normal identifier.
entrypoints). Previously this led to miscompiled output such as for (undefined; i < len; i++).
Repro snippet
Here is full repro code with latest bun, and other transpliers
Output:
undefined; i < len; ++ii = 0, len = arr.length; i < len; ++iHow did you verify your code works?