Skip to content

Port TypeScript PR #63054: Default types to [], support "*" wildcard#2688

Open
Copilot wants to merge 3 commits intomainfrom
copilot/port-typescript-pull-63054
Open

Port TypeScript PR #63054: Default types to [], support "*" wildcard#2688
Copilot wants to merge 3 commits intomainfrom
copilot/port-typescript-pull-63054

Conversation

Copy link
Contributor

Copilot AI commented Feb 5, 2026

Ports microsoft/TypeScript#63054. Changes default behavior: when types is unset, no @types packages are auto-discovered. Use types: ["*"] for the previous behavior.

Core Changes

  • internal/core/compileroptions.go: Add UsesWildcardTypes() method—returns true if types contains "*"
  • internal/module/resolver.go: Update GetAutomaticTypeDirectiveNames():
    • No wildcard → return types directly (or [] if nil)
    • Wildcard present → enumerate type roots, substitute "*" with discovered packages, deduplicate
  • internal/checker/checker.go: Swap diagnostic message selection logic—now suggests adding to types when wildcards are NOT in use
  • internal/compiler/fileInclude.go: Update automatic type directive file diagnostics to use new wildcard check

Example

// Old behavior (auto-discover all @types)
{ "compilerOptions": { } }

// New equivalent (explicit wildcard)
{ "compilerOptions": { "types": ["*"] } }

// Explicit subset only
{ "compilerOptions": { "types": ["node", "jest"] } }

// Mix explicit + wildcard
{ "compilerOptions": { "types": ["my-special-types", "*"] } }

Test Updates

  • Baseline changes reflect updated error messages (TS2580 → TS2591 with types field instructions)
  • Two fourslash tests added to failingTests.txt—depend on old auto-discovery behavior, will resolve when TypeScript submodule updates
Original prompt

Port microsoft/TypeScript#63054

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


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

… `"*"` wildcard

Co-authored-by: RyanCavanaugh <6685088+RyanCavanaugh@users.noreply.github.com>
Copilot AI changed the title [WIP] Port TypeScript pull request 63054 Port TypeScript PR #63054: Default types to [], support "*" wildcard Feb 5, 2026
Copilot AI requested a review from RyanCavanaugh February 5, 2026 01:06
@jakebailey jakebailey marked this pull request as ready for review February 18, 2026 03:42
Copilot AI review requested due to automatic review settings February 18, 2026 03:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR ports TypeScript PR #63054, implementing a breaking change where types defaults to [] (no auto-discovery) instead of discovering all @types packages. Users must explicitly use types: ["*"] to enable the previous auto-discovery behavior.

Changes:

  • Added UsesWildcardTypes() method to check if types contains "*"
  • Modified automatic type directive resolution to handle wildcard substitution
  • Swapped diagnostic messages to recommend adding to types field when wildcards are NOT in use
  • Updated test baselines to reflect new error messages (TS2580→TS2591, TS2581→TS2592, etc.)

Reviewed changes

Copilot reviewed 156 out of 156 changed files in this pull request and generated no comments.

Show a summary per file
File Description
internal/core/compileroptions.go Added UsesWildcardTypes() helper method
internal/module/resolver.go Updated GetAutomaticTypeDirectiveNames() to handle wildcard expansion and return empty array by default
internal/checker/checker.go Inverted diagnostic message logic - now suggests adding to types when NO wildcard
internal/compiler/fileInclude.go Updated to use UsesWildcardTypes() instead of checking Types != nil
testdata/baselines/reference/** Updated test baselines reflecting new default behavior
internal/fourslash/_scripts/failingTests.txt Removed 3 tests that now pass

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.

3 participants