fix(expression): end type annotation at function body brace#224
Conversation
A `{` following a completed type now ends the return type annotation so a
`>` in the body is no longer parsed as a closing generic bracket.
Fixes #215
🦋 Changeset detectedLatest commit: 815055c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #224 +/- ##
=======================================
Coverage 99.95% 99.95%
=======================================
Files 34 34
Lines 4223 4233 +10
Branches 780 782 +2
=======================================
+ Hits 4221 4231 +10
Misses 2 2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (3)
Walkthrough
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Port htmljs-parser's statement-function return type fix to the external
scanner. A `{` following a completed type now ends the type annotation so
a `>` in the function body is no longer parsed as a closing generic
bracket. If the preceding non-whitespace is an operator/continuation the
`{` is treated as part of the type (eg an object return type) and type
mode stays on.
Mirrors marko-js/htmljs-parser#224.
Port htmljs-parser's statement-function return type fix to the external
scanner. A `{` following a completed type now ends the type annotation so
a `>` in the function body is no longer parsed as a closing generic
bracket. If the preceding non-whitespace is an operator/continuation the
`{` is treated as part of the type (eg an object return type) and type
mode stays on.
Mirrors marko-js/htmljs-parser#224.
Fixes #215.
A statement function (
export/static) that declares a return type left the parser in "type" mode for the body, so a>was parsed as a closing generic bracket:A
{that follows a completed type now ends the annotation and the block is parsed as a value. Object types (x: { a: 1 }), generics, andtype/interface/declarebodies are unaffected. Adds a regression fixture.Generated by Claude Code