feat: read types in scriptlets and after extra whitespace - #254
Conversation
A scriptlet never looked for `declare`/`interface`/`type`, so a type in one
was lexed as JavaScript and a line-final `void` or `>` carried it into the
next line: `$ type H = () => void` followed by `<div/>` became one scriptlet.
Statements looked for the keyword only exactly one character past the tag
name, so `static type F = () => void` missed it the same way.
Scriptlets and statements now share `prepareScriptlet`, which skips spaces
before the keyword and requires a name after it (or `{`/`*` after `type`,
as in `import type { A }`), so `$ type = a < b` and `$ type in obj` stay
JavaScript. `isValidScriptlet` uses it too.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
🦋 Changeset detectedLatest commit: 6109ab6 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 |
|
Warning Review limit reached
This review includes 9 billable files and costs up to $2.25.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 59 minutes for your next included review. View limit detailsLimit details: You’ve used all 2 included reviews currently available. Your 51 included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Essentials Run ID: ⛔ Files ignored due to path filters (3)
📒 Files selected for processing (9)
Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## dpiercey-ws-marko-invariants-jcdpv7-parserfixes-operators #254 +/- ##
=============================================================================================
- Coverage 99.95% 99.89% -0.07%
=============================================================================================
Files 35 35
Lines 4652 4695 +43
Branches 896 907 +11
=============================================================================================
+ Hits 4650 4690 +40
- Misses 2 4 +2
- Partials 0 1 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
A scriptlet never looked for
declare/interface/type, so$ type H = () => voidor$ type A = B<C>swallowed the next line, and a statement missed the keyword after extra spaces (static type F = () => void). Scriptlets and statements now share one look-ahead that skips spaces and requires a name after the keyword (or{/*aftertype), so$ type = a < band$ type in objstay JavaScript.isValidScriptletuses it too.🤖 Generated with Claude Code