Skip to content

fix: support type parameters on arrow functions - #1692

Open
mayankdhingra02 wants to merge 1 commit into
dsherret:latestfrom
mayankdhingra02:arrow-function-type-parameters
Open

mayankdhingra02 wants to merge 1 commit into
dsherret:latestfrom
mayankdhingra02:arrow-function-type-parameters

Conversation

@mayankdhingra02

Copy link
Copy Markdown

Adding the first type parameters to an arrow function throws NotImplementedError. Insert them before the parameter list, adding parentheses around a bare parameter when needed. Preserve cached parameter and identifier nodes so later renames still work.

Single type parameters in TSX get a trailing comma to avoid being parsed as JSX. Regressions cover ordinary and async arrows, comments, existing generics, TSX, cached-node renames, and unchanged input for empty additions or invalid indices.

Fixes #1680.

Validation on TypeScript 6.0.2:

  • Full package suites: 5,406 passing, 2 pending; 45 focused tests pass.
  • Node and Deno builds, project type checks, code verification, and formatting pass.
  • Deno smoke tests: 2 passed; package publish dry run passes.

Signed-off-by: Mayank Dhingra <mayankdhingra02@gmail.com>
@mayankdhingra02

Copy link
Copy Markdown
Author

Could a maintainer approve the pending CI run when convenient? The local package tests, Node and Deno builds, type checks and formatting passed, as documented in the PR description. Thanks.

This branch has not been deployed

No deployments
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.

Inserting type parameters for node with kind ArrowFunction

1 participant