Skip to content

Fix TypeScript func_start regex to avoid matching parameter annotations - #1771

Closed
squid-protocol wants to merge 2 commits into
mainfrom
fix-typescript-func-start-regex
Closed

Fix TypeScript func_start regex to avoid matching parameter annotations#1771
squid-protocol wants to merge 2 commits into
mainfrom
fix-typescript-func-start-regex

Conversation

@squid-protocol

Copy link
Copy Markdown
Owner

This PR fixes a bug in the TypeScript func_start regex where it would mistakenly match parameter type annotations like f: (...a: A) => B and incorrectly identify them as function starts. The regex now uses a lookahead to ensure that the arrow is followed by a structural boundary (a block {, type arguments <, or parenthesized grouping (), allowing it to correctly identify object-literal arrow functions without matching generic parameter types.

This resolves numerous missed function and argument-count mismatches when compared against tree-sitter.

The golden masters for tests have been regenerated and included in this PR.

Improved TypeScript func_start regex to correctly detect arrow functions inside object literals, reducing missed function detections and argument count mismatches.
@github-actions

Copy link
Copy Markdown
Contributor

🐦‍⬛ Muninn Security Scan

✅ No security issues found.

🐦‍⬛ Powered by Muninn · Skald Lab

@squid-protocol
squid-protocol deleted the fix-typescript-func-start-regex branch August 16, 2026 23:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant