fix(angular-compiler): skip arrow fn types when finding assignment = …#2274
Conversation
…in field lowering findEqualsSign() scanned from key.end to value.start for the assignment `=`, but for private fields with arrow function type annotations (e.g. `#cb: (() => void) | null = null`) it matched the `=` inside `=>` first, removing part of the type annotation and producing invalid output like `#cb: (() ;`. Fix: when a type annotation is present, start scanning from typeAnnotation.end instead of key.end.
✅ Deploy Preview for analog-blog ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for analog-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
✅ Deploy Preview for analog-app ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughThis PR fixes a bug in private class field lowering where the Estimated code review effort🎯 2 (Simple) | ⏱️ ~12 minutes 🚥 Pre-merge checks | ✅ 2✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
findEqualsSign()in class field lowering scanned fromkey.endtovalue.startfor the assignment=, but for privatefields with arrow function type annotations (e.g.
#cb: (() => void) | null = null) it matched the=inside=>first,removing part of the type annotation and producing invalid output like
#cb: (() ;.Fix: when a type annotation is present, start scanning from typeAnnotation.end instead of key.end.
PR Checklist
Closes #
Affected scope
Recommended merge strategy for maintainer [optional]
Commit preservation note [optional]
What is the new behavior?
When a private class field has a type annotation,
findEqualsSign()now starts scanning fromtypeAnnotation.endinstead ofkey.end, skipping past any=characters inside arrow function type annotations (=>). This ensures only the actual assignment=is matched.Test plan
nx format:checkpnpm buildpnpm testDoes this PR introduce a breaking change?
Other information
[optional] What gif best describes this PR or how it makes you feel?