Skip to content

Fix target library hints for readonly interfaces and tuples - #64970

Open
Mahesh Rijal (maheshrijal) wants to merge 2 commits into
microsoft:mainfrom
maheshrijal:fix/readonly-lib-suggestions
Open

Mahesh Rijal (maheshrijal) wants to merge 2 commits into
microsoft:mainfrom
maheshrijal:fix/readonly-lib-suggestions

Conversation

@maheshrijal

Copy link
Copy Markdown

Fixes #61323

Analysis

The missing-property diagnostic looks up the apparent type's symbol in the feature map, which has no entries for ReadonlyArray, ReadonlyMap, or ReadonlySet. Tuples have no symbol, so the issue's ([1, 2, 3] as const).toReversed() example also misses the ES2023 library hint.

Fix

Add readonly feature entries matching the bundled declarations, excluding mutable-only methods. For tuple property lookups, select Array or ReadonlyArray using the tuple's readonly flag. This also gives mutable tuples the library hint while preserving the original receiver type in diagnostics.

The shared missing-name lookup now treats the readonly names like its existing entries, so unresolved readonly type names can receive TS2304 instead of a spelling suggestion.

The new compiler fixtures cover old and current libraries, partial ES2015 libraries, tuples, constrained generics, and unsupported readonly mutators. Existing baselines are unchanged. Validation included focused tests, test:all, package builds and tests, benchmarks, lint, formatting, and module tidy checks. An initial run had macOS filesystem-watcher timeouts; subsequent full runs passed.

Copilot Checklist

  • npx hereby validate

AI assistance: Codex implemented the change; Claude Code and Gemini assisted with review.

Copilot AI balanced review requested due to automatic review settings October 26, 2026 14:11
@github-project-automation github-project-automation Bot moved this to Not started in PR Backlog Oct 26, 2026
@typescript-automation typescript-automation Bot added the For Backlog Bug PRs that fix a backlog bug label Oct 26, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@maheshrijal

Copy link
Copy Markdown
Author

@microsoft-github-policy-service agree

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

For Backlog Bug PRs that fix a backlog bug

Projects

Status: Not started

Development

Successfully merging this pull request may close these issues.

Suggestion: Support readonly interfaces in getSuggestedLibFor...

2 participants