Skip to content

Fix declaration emit readonly tuple regression from as const satisfies#3199

Draft
Copilot wants to merge 4 commits intomainfrom
copilot/fix-declaration-emit-issue
Draft

Fix declaration emit readonly tuple regression from as const satisfies#3199
Copilot wants to merge 4 commits intomainfrom
copilot/fix-declaration-emit-issue

Conversation

Copy link
Contributor

Copilot AI commented Mar 22, 2026

  • Understand the issue: regression in declaration emit where readonly is incorrectly added to tuple types after PR Port --isolatedDeclarations related node builder logic, with baseline updates #2459
  • Create test case from issue comment #4105762522
  • Run test and accept baselines to show the declaration emit issue
  • Identify root cause: pseudoTypeEquivalentToType doesn't check the tuple readonly flag, and pseudoTypeToNode always emits tuples as readonly
  • Apply fix to pseudoTypeEquivalentToType in pseudotypenodebuilder.go
  • Run test and verify fix produces correct output matching TypeScript 5.9/6.0
  • Accept corrected baselines
  • Run full test suite - all tests pass
Original prompt

This section details on the original issue you should resolve

<issue_title>0320 vs 0321</issue_title>
<issue_description>## Steps to reproduce

clone, do a bun i and then bun run build
see https://github.com/workglow-dev/workglow/actions/runs/23388170259/job/68038462188

tsc and tsgo as of yesterday had no issues. This only started today with Saturday March 21 build. tsgo =7.0.0-dev.20260321.1

when pinned to 7.0.0-dev.20260320.1

https://github.com/workglow-dev/workglow/actions/runs/23388410799/job/68039071095 (no issues)</issue_description>

<agent_instructions>See #3192 (comment) for the test. Make the test first, run and accept baselines to show the declaration emit issue, then work on the bug. See all referenced issues and PRs.</agent_instructions>

Comments on the Issue (you are @copilot in this section)

@jakebailey A CI log isn't a repro; can you give us something we can test in isolation without a big repo? Or bisect it? @jakebailey Yes, if it differs from TS6, it should be reported; I am assuming a regression from #2459

Custom agent used: Issue Investigator
An expert at reproducing, investigating, and diagnosing issues


⌨️ Start Copilot coding agent tasks without leaving your editor — available in VS Code, Visual Studio, JetBrains IDEs and Eclipse.

Copilot AI and others added 2 commits March 22, 2026 16:16
#3192)

The pseudoTypeEquivalentToType check for PseudoTypeKindTuple didn't verify
the readonly flag on the real tuple type. Since pseudoTypeToNode always emits
tuples as readonly, non-readonly tuples (e.g. from `as const satisfies T`
where T has a mutable array) were incorrectly emitted with readonly.

Added a readonly check so non-readonly tuples fall back to the regular type
serialization path which correctly handles the readonly flag.

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/69ed8fd3-8200-40eb-9fea-76f2981bcf67
Copilot AI changed the title [WIP] Fix declaration emit issue in tsgo version 7.0.0-dev.20260321.1 Fix declaration emit readonly tuple regression from as const satisfies Mar 22, 2026
Copilot AI requested a review from jakebailey March 22, 2026 16:25
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot delete this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in c45b733.

Co-authored-by: jakebailey <5341706+jakebailey@users.noreply.github.com>
Agent-Logs-Url: https://github.com/microsoft/typescript-go/sessions/0ad4fe84-2fcc-4899-829b-a10744f8f15a
Copilot AI requested a review from jakebailey March 22, 2026 16:45
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.

0320 vs 0321

2 participants