Skip to content

Conversation

@magic-akari
Copy link
Contributor

@magic-akari magic-akari commented Dec 6, 2025

This aligns with Node.js PR nodejs/node#60864, which allows defining symmetric exports and imports fields in package.json:

{
  "exports": { "./*": "./src/*" },
  "imports": { "#/*": "./src/*" }
}

Fixes #62841

This aligns with Node.js PR nodejs/node#60864, which allows defining
symmetric `exports` and `imports` fields in package.json:

{
  "exports": { "./*": "./src/*" },
  "imports": { "#/*": "./src/*" }
}
@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Dec 6, 2025
@magic-akari magic-akari marked this pull request as ready for review December 6, 2025 04:03
Copilot AI review requested due to automatic review settings December 6, 2025 04:03
Copy link

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 enables TypeScript to support subpath imports starting with #/* in package.json, aligning with Node.js behavior. Previously, TypeScript rejected these patterns, but they are now valid according to Node.js PR nodejs/node#60864.

  • Removed restriction that blocked #/* import patterns
  • Added comprehensive test coverage for the new functionality

Reviewed changes

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

File Description
src/compiler/moduleNameResolver.ts Removed check that prevented #/* subpath imports
tests/cases/conformance/node/nodeModulesPackageImportsRootWildcard.ts Added test case validating #/* imports across ESM/CJS modules
tests/cases/fourslash/importCompletionsPackageJsonImportsPatternRootWildcard.ts Added test for import completions with #/* pattern
tests/baselines/reference/nodeModulesPackageImportsRootWildcard(module=). Generated baseline files for various module configurations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

For Uncommitted Bug PR for untriaged, rejected, closed or missing bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Module Resolution: allow subpath imports that start with #/

2 participants