Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Oct 9, 2025

This PR ports microsoft/TypeScript#60234 to the Go implementation, bringing TypeScript emit closer to what an external tool could produce without full type information.

Changes

Modified internal/checker/nodebuilderimpl.go in the signatureToSignatureDeclarationHelper function:

  • Removed the call to getExpandedParameters
  • Changed to use signature.parameters directly when calling enterNewScope
  • Simplified the parameter mapping logic since expandedParams and originalParameters are now the same

Impact

This change improves how rest parameter types are displayed in function signatures:

Before:

declare let f1: (x_0: number, x_1: string, x_2: boolean) => void;

After:

declare let f1: (...x: [number, string, boolean]) => void;

The improved signatures are more readable and natural, better matching how developers would write them manually. This affects 111 baseline files, primarily in tests dealing with rest parameters, variadic tuples, and contextual typing.

Note on Partial Port

The original TypeScript PR made two changes:

  1. In checker.ts: Use signature.parameters directly instead of getExpandedParameters - ✅ Applied here
  2. In expressionToTypeNode.ts: Make typeFromFunctionLikeExpression return a proper function type node - ⚠️ Not applicable (file not yet ported to Go)

This partial port provides immediate benefits. The full benefits of the PR will be realized when expressionToTypeNode.ts is eventually ported to Go, which would enable using typeof references in return types (e.g., a: typeof a instead of a: [n: "n", a: "a"]).

Testing

  • ✅ All tests pass
  • ✅ Baseline changes accepted and verified
  • ✅ Code review found no issues
Original prompt

From the TypeScript repo, port PR#60234

Note

Custom agent used: Strada to Corsa Port Expert
A Go and TypeScript expert who can easily figure out how to port PRs from one language to another


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@Copilot Copilot AI changed the title [WIP] Port PR#60234 from TypeScript repo Port PR#60234: Use signature.parameters directly instead of getExpandedParameters Oct 9, 2025
@Copilot Copilot AI requested a review from RyanCavanaugh October 9, 2025 21:43
Copilot finished work on behalf of RyanCavanaugh October 9, 2025 21:43
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.

2 participants