Skip to content

Disable package.json conditional exports fallback lookups #62310

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

andrewbranch
Copy link
Member

Fixes #50762

@Copilot Copilot AI review requested due to automatic review settings August 20, 2025 22:26
@github-project-automation github-project-automation bot moved this to Not started in PR Backlog Aug 20, 2025
@typescript-bot typescript-bot added Author: Team For Milestone Bug PRs that fix a bug with a specific milestone labels Aug 20, 2025
Copy link

@Copilot 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 disables package.json conditional exports fallback lookups by modifying the module resolution logic to return immediately when a condition fails to resolve, preventing TypeScript from falling back to other conditions like 'types' when the primary condition ('import') doesn't find TypeScript declaration files.

Key changes:

  • Modified module resolution logic to stop searching after first failed condition
  • Updated test baselines to reflect the new resolution behavior where .mjs files are resolved directly instead of falling back to .d.ts files
  • Removed outdated comments describing the previous fallback behavior

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.

File Description
src/compiler/moduleNameResolver.ts Added early return to prevent fallback condition searches
tests/cases/conformance/moduleResolution/conditionalExportsResolutionFallback.ts Removed comment describing old fallback behavior
tests/baselines/reference/*.trace.json Updated trace logs showing direct .mjs resolution instead of .d.ts fallback
tests/baselines/reference/*.errors.txt Removed comments about fallback behavior from error baselines

@andrewbranch
Copy link
Member Author

@typescript-bot test top800

@typescript-bot
Copy link
Collaborator

typescript-bot commented Aug 20, 2025

Starting jobs; this comment will be updated as builds start and complete.

Command Status Results
test top800 ✅ Started 👀 Results

@typescript-bot
Copy link
Collaborator

@andrewbranch Here are the results of running the top 800 repos with tsc comparing main and refs/pull/62310/merge:

Something interesting changed - please have a look.

Details

ahmedkhaleel2004/gitdiagram

tsconfig.json

  • error TS2307: Cannot find module 'geist/font/sans' or its corresponding type declarations.
  • error TS2322: Type '{ children: string; key: string; variant: string; className: string; onClick: (e: MouseEvent<HTMLButtonElement, MouseEvent>) => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS7016: Could not find a declaration file for module 'class-variance-authority'. '/mnt/ts_downloads/_/m/gitdiagram/node_modules/.pnpm/[email protected]/node_modules/class-variance-authority/dist/index.mjs' implicitly has an 'any' type.
  • error TS2339: Property 'variant' does not exist on type 'ButtonProps'.
  • error TS2339: Property 'size' does not exist on type 'ButtonProps'.

alan2207/bulletproof-react

apps/react-vite/tsconfig.json

anthropics/anthropic-quickstarts

financial-data-analyst/tsconfig.json

customer-support-agent/tsconfig.json

caorushizi/mediago

2 of 7 projects failed to build with the old tsc and were ignored

packages/renderer/tsconfig.json

captbaritone/webamp

4 of 7 projects failed to build with the old tsc and were ignored

examples/lazy/tsconfig.json

@typescript-bot
Copy link
Collaborator

@andrewbranch Here are some more interesting changes from running the top 800 repos suite

Details

coaidev/coai

app/tsconfig.json

@typescript-bot
Copy link
Collaborator

@andrewbranch Here are some more interesting changes from running the top 800 repos suite

Details

Dokploy/dokploy

2 of 6 projects failed to build with the old tsc and were ignored

packages/server/tsconfig.json

apps/dokploy/tsconfig.json

@typescript-bot
Copy link
Collaborator

@andrewbranch Here are some more interesting changes from running the top 800 repos suite

Details

facebook/lexical

6 of 16 projects failed to build with the old tsc and were ignored

examples/react-rich-collab/tsconfig.json

@typescript-bot
Copy link
Collaborator

@andrewbranch Here are some more interesting changes from running the top 800 repos suite

Details

getAsterisk/claudia

tsconfig.json

@typescript-bot
Copy link
Collaborator

@andrewbranch Here are some more interesting changes from running the top 800 repos suite

Details

github/docs

1 of 2 projects failed to build with the old tsc and were ignored

tsconfig.json

immutable-js/immutable-js

4 of 6 projects failed to build with the old tsc and were ignored

website/tsconfig.json

  • error TS7016: Could not find a declaration file for module '@jdeniau/immutable-devtools'. '/mnt/ts_downloads/_/m/immutable-js/node_modules/@jdeniau/immutable-devtools/dist/index.mjs' implicitly has an 'any' type.

inkonchain/ink-kit

tsconfig.json

ionic-team/ionicons

1 of 2 projects failed to build with the old tsc and were ignored

tsconfig.json

  • error TS2688: Cannot find type definition file for 'svgo'.
    • Project Scope

@typescript-bot
Copy link
Collaborator

@andrewbranch Here are some more interesting changes from running the top 800 repos suite

Details

karakeep-app/karakeep

apps/web/tsconfig.json

apps/mobile/tsconfig.json

apps/landing/tsconfig.json

apps/browser-extension/tsconfig.json

  • error TS2322: Type '{ children: Element; variant: string; onClick: () => void; className: string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: Element; variant: string; size: string; onClick: () => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.

@typescript-bot
Copy link
Collaborator

@andrewbranch Here are some more interesting changes from running the top 800 repos suite

Details

Kilo-Org/kilocode

2 of 13 projects failed to build with the old tsc and were ignored

webview-ui/tsconfig.json

src/tsconfig.json

apps/web-roo-code/tsconfig.json

apps/web-evals/tsconfig.json

logto-io/logto

18 of 33 projects failed to build with the old tsc and were ignored

packages/demo-app/tsconfig.json

menloresearch/jan

7 of 10 projects failed to build with the old tsc and were ignored

docs/tsconfig.json

microsoft/vscode

7 of 61 projects failed to build with the old tsc and were ignored

extensions/github/tsconfig.json

mikro-orm/mikro-orm

15 of 37 projects failed to build with the old tsc and were ignored

tests/tsconfig.json

@typescript-bot
Copy link
Collaborator

@andrewbranch Here are some more interesting changes from running the top 800 repos suite

Details

miurla/morphic

tsconfig.json

  • error TS2322: Type '{ children: Element; type: "button"; variant: string; size: string; className: string; onClick: () => void; title: string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: Element; variant: string; size: string; onClick: () => void; className: string; type: "button"; disabled: boolean; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: Element; type: "button" | "submit"; size: string; variant: string; className: string; disabled: boolean; onClick: (() => void) | undefined; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: Element; className: string; size: string; variant: string; onClick: () => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: string | Element; onClick: () => Promise<void>; disabled: boolean; size: string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: string; onClick: () => void; disabled: boolean; size: string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: string; variant: string; className: string; disabled: boolean; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: (string | Element)[]; key: number; variant: string; className: string; name: string; onClick: () => Promise<void>; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: (string | Element)[]; variant: string; size: string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: Element; variant: string; size: string; onClick: () => void; "aria-label": string; tooltipContent: string; }' is not assignable to type 'IntrinsicAttributes & TooltipButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: string; variant: string; type: "button"; className: string; onClick: () => Promise<void>; disabled: boolean; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: Element; variant: string; size: string; onClick: () => Promise<void>; className: string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: (string | Element)[]; variant: string; role: "combobox"; "aria-expanded": boolean; className: string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: (string | Element)[]; type: "button"; variant: string; onClick: () => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: (string | Element)[]; className: string; variant: string; }' is not assignable to type 'IntrinsicAttributes & BadgeProps'.
  • error TS2322: Type '{ children: string; variant: string; className: string; type: "submit"; name: string; value: string; onClick: () => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: Element[]; className: string; type: "button"; variant: string; size: string; onClick: () => Promise<string | null | undefined>; "aria-label": string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: (string | number)[]; variant: string; className: string; onClick: () => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: (string | ReactElement<any, string | JSXElementConstructor<any>>)[]; variant: string; className: string; }' is not assignable to type 'IntrinsicAttributes & BadgeProps'.
  • error TS2322: Type '{ children: (Element | ReactNode)[]; className: string | undefined; variant: string; }' is not assignable to type 'IntrinsicAttributes & BadgeProps'.
  • error TS7016: Could not find a declaration file for module 'class-variance-authority'. '/mnt/ts_downloads/_/m/morphic/node_modules/class-variance-authority/dist/index.mjs' implicitly has an 'any' type.
  • error TS2339: Property 'variant' does not exist on type 'BadgeProps'.
  • error TS2339: Property 'variant' does not exist on type 'ButtonProps'.
  • error TS2339: Property 'size' does not exist on type 'ButtonProps'.
  • error TS2339: Property 'variant' does not exist on type 'Omit<ButtonProps & RefAttributes<HTMLButtonElement>, "ref">'.
  • error TS2339: Property 'size' does not exist on type 'Omit<ButtonProps & RefAttributes<HTMLButtonElement>, "ref">'.
  • error TS2322: Type '{ children: Element[]; name?: string | undefined; value?: string | number | readonly string[] | undefined; prefix?: string | undefined; translate?: "yes" | "no" | undefined; content?: string | undefined; ... 285 more ...; className: string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: Element[]; variant: string; className: string; onClick: () => void; size: string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: Element[]; variant: string; size: string; className: string; onClick: () => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2339: Property 'side' does not exist on type 'SheetContentProps'.
  • error TS2322: Type '{ children: Element[]; "data-sidebar": string; "data-mobile": string; className: string; style: CSSProperties; side: "right" | "left"; }' is not assignable to type 'IntrinsicAttributes & SheetContentProps & RefAttributes<HTMLDivElement>'.
  • error TS2322: Type '{ children: Element[]; name?: string | undefined; value?: string | number | readonly string[] | undefined; prefix?: string | undefined; translate?: "yes" | "no" | undefined; content?: string | undefined; ... 286 more ...; onClick: (event: MouseEvent<...>) => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: Element; variant: string; className: string; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: string; variant: string; size: string; onClick: () => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: string; size: string; onClick: () => Promise<void>; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.
  • error TS2322: Type '{ children: Element; variant: string; size: string; className: string; onClick: (e: MouseEvent<HTMLButtonElement, MouseEvent>) => void; }' is not assignable to type 'IntrinsicAttributes & ButtonProps & RefAttributes<HTMLButtonElement>'.

musistudio/claude-code-router

2 of 3 projects failed to build with the old tsc and were ignored

ui/tsconfig.json

nextauthjs/next-auth

24 of 45 projects failed to build with the old tsc and were ignored

packages/adapter-xata/tsconfig.json

packages/adapter-surrealdb/tsconfig.json

nextjs/saas-starter

tsconfig.json

  • error TS7016: Could not find a declaration file for module 'class-variance-authority'. '/mnt/ts_downloads/_/m/saas-starter/node_modules/.pnpm/[email protected]/node_modules/class-variance-authority/dist/index.mjs' implicitly has an 'any' type.

@typescript-bot
Copy link
Collaborator

@andrewbranch Here are some more interesting changes from running the top 800 repos suite

Details

nhost/nhost

33 of 41 projects failed to build with the old tsc and were ignored

dashboard/tsconfig.test.json

dashboard/tsconfig.json

nitrojs/nitro

12 of 13 projects failed to build with the old tsc and were ignored

tsconfig.json

@typescript-bot
Copy link
Collaborator

@andrewbranch Here are some more interesting changes from running the top 800 repos suite

Details

octokit/octokit.js

tsconfig.json

  • error TS7016: Could not find a declaration file for module '@octokit/plugin-rest-endpoint-methods'. '/mnt/ts_downloads/_/m/octokit.js/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.js' implicitly has an 'any' type.

openstatusHQ/openstatus

11 of 27 projects failed to build with the old tsc and were ignored

apps/dashboard/tsconfig.json

Portkey-AI/gateway

1 of 2 projects failed to build with the old tsc and were ignored

cookbook/integrations/vercel/tsconfig.json

primefaces/primeng

apps/showcase/tsconfig.json

probot/probot

tsconfig.json

  • error TS7006: Parameter 'options' implicitly has an 'any' type.
  • error TS7006: Parameter 'file' implicitly has an 'any' type.
  • error TS7016: Could not find a declaration file for module '@octokit/plugin-rest-endpoint-methods'. '/mnt/ts_downloads/_/m/probot/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.js' implicitly has an 'any' type.

test/tsconfig.json

  • error TS7006: Parameter 'options' implicitly has an 'any' type.
  • error TS7006: Parameter 'file' implicitly has an 'any' type.
  • error TS7016: Could not find a declaration file for module '@octokit/plugin-rest-endpoint-methods'. '/mnt/ts_downloads/_/m/probot/node_modules/@octokit/plugin-rest-endpoint-methods/dist-src/index.js' implicitly has an 'any' type.

QwenLM/qwen-code

3 of 5 projects failed to build with the old tsc and were ignored

packages/vscode-ide-companion/tsconfig.json

  • error TS7016: Could not find a declaration file for module 'jsonrepair'. '/mnt/ts_downloads/_/m/qwen-code/node_modules/jsonrepair/lib/esm/index.js' implicitly has an 'any' type.

RSSNext/Folo

4 of 18 projects failed to build with the old tsc and were ignored

packages/internal/components/tsconfig.json

apps/mobile/web-app/html-renderer/tsconfig.json

  • error TS7016: Could not find a declaration file for module '@sentry/vite-plugin'. '/mnt/ts_downloads/_/m/Folo/node_modules/@sentry/vite-plugin/dist/esm/index.mjs' implicitly has an 'any' type.

ryoppippi/ccusage

1 of 2 projects failed to build with the old tsc and were ignored

tsconfig.json

shadcn-ui/ui

19 of 27 projects failed to build with the old tsc and were ignored

templates/monorepo-next/packages/ui/tsconfig.json

templates/monorepo-next/apps/web/tsconfig.json

steven-tey/novel

1 of 2 projects failed to build with the old tsc and were ignored

packages/headless/tsconfig.json

TanStack/query

78 of 118 projects failed to build with the old tsc and were ignored

packages/svelte-query-devtools/tsconfig.json

packages/solid-query-devtools/tsconfig.prod.json

packages/solid-query-devtools/tsconfig.json

packages/react-query-devtools/tsconfig.legacy.json

packages/react-query-devtools/tsconfig.json

packages/query-devtools/tsconfig.prod.json

packages/angular-query-persist-client/tsconfig.json

packages/angular-query-devtools-experimental/tsconfig.json

transloadit/uppy

20 of 62 projects failed to build with the old tsc and were ignored

packages/@uppy/companion/tsconfig.json

TypeCellOS/BlockNote

4 of 81 projects failed to build with the old tsc and were ignored

packages/server-util/tsconfig.json

packages/dev-scripts/tsconfig.json

web-infra-dev/midscene

7 of 14 projects failed to build with the old tsc and were ignored

packages/mcp/tsconfig.json

packages/android-playground/tsconfig.json

apps/report/tsconfig.json

apps/chrome-extension/tsconfig.json

apps/android-playground/tsconfig.json

webdriverio/webdriverio

28 of 49 projects failed to build with the old tsc and were ignored

packages/wdio-cucumber-framework/tsconfig.json

zaidmukaddam/scira

tsconfig.json

@andrewbranch
Copy link
Member Author

This may well be more breaky than it's worth. We might just be stuck with this :/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Author: Team For Milestone Bug PRs that fix a bug with a specific milestone
Projects
Status: Not started
Development

Successfully merging this pull request may close these issues.

package.json exports resolution uses fallback conditions, unlike Node
2 participants