Skip to content

Port --enforceReadonly to the Go compiler - #64057

Draft
Anders Hejlsberg (ahejlsberg) with Copilot wants to merge 4 commits into
mainfrom
copilot/port-enforcereadonly-to-go
Draft

Port --enforceReadonly to the Go compiler#64057
Anders Hejlsberg (ahejlsberg) with Copilot wants to merge 4 commits into
mainfrom
copilot/port-enforcereadonly-to-go

Conversation

Copilot AI commented Aug 27, 2026

Copy link
Copy Markdown
Contributor

Ports the behavioral changes from microsoft/TypeScript#59326.

  • Adds enforceReadonly compiler-option parsing, CLI/help/init output, diagnostics, and API schema generation.
  • Rejects readonly-to-mutable property and index-signature relationships outside comparable relations; preserves method exemptions.
  • Extends mapped-type relation handling and const-context inference for readonly constraints.
  • Adds compiler and command-line baseline coverage.
// @enforceReadonly: true
let mutable: { x: string };
declare const readonlyValue: { readonly x: string };

mutable = readonlyValue; // Error

Copilot AI and others added 3 commits August 27, 2026 19:03
Co-authored-by: ahejlsberg <4226954+ahejlsberg@users.noreply.github.com>
Co-authored-by: ahejlsberg <4226954+ahejlsberg@users.noreply.github.com>
Co-authored-by: ahejlsberg <4226954+ahejlsberg@users.noreply.github.com>
Copilot AI changed the title [WIP] Port changes from TypeScript PR #59326 to Go codebase Port --enforceReadonly to the Go compiler Aug 27, 2026
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