René's URL Explorer Experiment


Title: Declaration emit writes an import the file cannot resolve when the package has `exports`; no TS2883 · Issue #64590 · microsoft/TypeScript · GitHub

Open Graph Title: Declaration emit writes an import the file cannot resolve when the package has `exports`; no TS2883 · Issue #64590 · microsoft/TypeScript

X Title: Declaration emit writes an import the file cannot resolve when the package has `exports`; no TS2883 · Issue #64590 · microsoft/TypeScript

Description: 🔎 Search Terms TS2883, TS2742, cannot be named without a reference, not portable, declaration emit module specifier, exports map, pnpm, import type cannot be resolved, skipLibCheck any 🕗 Version & Regression Information This is the behav...

Open Graph Description: 🔎 Search Terms TS2883, TS2742, cannot be named without a reference, not portable, declaration emit module specifier, exports map, pnpm, import type cannot be resolved, skipLibCheck any 🕗 Version & ...

X Description: 🔎 Search Terms TS2883, TS2742, cannot be named without a reference, not portable, declaration emit module specifier, exports map, pnpm, import type cannot be resolved, skipLibCheck any 🕗 Version &a...

Opengraph URL: https://github.com/microsoft/TypeScript/issues/64590

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Declaration emit writes an import the file cannot resolve when the package has `exports`; no TS2883","articleBody":"### 🔎 Search Terms\n\nTS2883, TS2742, cannot be named without a reference, not portable, declaration emit module specifier, exports map, pnpm, import type cannot be resolved, skipLibCheck any\n\n### 🕗 Version & Regression Information\n\n- This is the behavior in every version I tried, and I reviewed the FAQ for entries about declaration emit and \"cannot be named\"\n\nTried: 6.0.3, 7.0.2, 7.1.0-dev.20261002.1.\n\n### ⏯ Playground Link\n\n_No response_ (needs a `node_modules` layout)\n\n### 💻 Code\n\nA strict `node_modules` layout, as pnpm makes it. `a` depends on `s`, `s` depends on `c`, and `a` cannot resolve `c`. The package `c` has an `exports` map with a subpath.\n\n```\nnode_modules/.store/c/node_modules/c/      package.json with \"exports\": { \"./Thing\": … }, dist/Thing.d.ts\npackages/s/node_modules/c            ->    the store\npackages/a/node_modules/s            ->    ../../s\npackages/u/node_modules/a            ->    ../../a\n```\n\n```ts\n// c/dist/Thing.d.ts\nexport interface Thing {\n  readonly x: number;\n}\nexport declare const create: () => Thing;\n\n// packages/s/src/index.ts   (composite project)\nimport { create } from \"c/Thing\";\nexport const made = create();\n\n// packages/a/src/index.ts   (composite project, references s)\nimport { made } from \"s\";\nexport const thing = { made };\n\n// packages/u/src/index.ts   (references a, skipLibCheck)\nimport { thing } from \"a\";\nexport const wrong: string = thing.made.x;\n```\n\n\u003cdetails>\n\u003csummary>Script that writes the project in a temporary directory and runs \u003ccode>tsc -b\u003c/code> (argument: the tsc command)\u003c/summary>\n\n```sh\n#!/bin/sh\n# usage: sh repro-1-import-out-of-reach.sh [tsc command]\nset -u\ntsc=${1:-tsc}\ncd \"$(mktemp -d)\" || exit 1\n# The physical path: on macOS the temporary directory is behind a symbolic link.\ncd \"$(pwd -P)\" || exit 1\nmkdir -p node_modules/.store/c/node_modules/c/dist packages/s/src packages/s/node_modules \\\n  packages/a/src packages/a/node_modules packages/u/src packages/u/node_modules\n\ncat >node_modules/.store/c/node_modules/c/package.json \u003c\u003c'JSON'\n{\n  \"name\": \"c\",\n  \"version\": \"1.0.0\",\n  \"type\": \"module\",\n  \"exports\": {\n    \"./Thing\": { \"types\": \"./dist/Thing.d.ts\", \"default\": \"./dist/Thing.js\" }\n  }\n}\nJSON\ncat >node_modules/.store/c/node_modules/c/dist/Thing.d.ts \u003c\u003c'TS'\nexport interface Thing {\n  readonly x: number;\n}\nexport declare const create: () => Thing;\nTS\n\nln -s ../../../node_modules/.store/c/node_modules/c packages/s/node_modules/c\nln -s ../../s packages/a/node_modules/s\nln -s ../../a packages/u/node_modules/a\n\nlibrary='{\n  \"compilerOptions\": {\n    \"composite\": true,\n    \"emitDeclarationOnly\": true,\n    \"module\": \"esnext\",\n    \"moduleResolution\": \"bundler\",\n    \"allowImportingTsExtensions\": true,\n    \"strict\": true,\n    \"rootDir\": \"src\",\n    \"outDir\": \"out\"\n  },\n  \"include\": [\"src\"]REFERENCES\n}'\n\necho '{ \"name\": \"s\", \"version\": \"1.0.0\", \"exports\": { \".\": \"./src/index.ts\" } }' >packages/s/package.json\nprintf '%s\\n' \"$library\" | sed 's/REFERENCES//' >packages/s/tsconfig.json\ncat >packages/s/src/index.ts \u003c\u003c'TS'\nimport { create } from \"c/Thing\";\n\nexport const made = create();\nTS\n\necho '{ \"name\": \"a\", \"version\": \"1.0.0\", \"exports\": { \".\": \"./src/index.ts\" } }' >packages/a/package.json\nprintf '%s\\n' \"$library\" | sed 's#REFERENCES#,\\n  \"references\": [{ \"path\": \"../s\" }]#' >packages/a/tsconfig.json\ncat >packages/a/src/index.ts \u003c\u003c'TS'\nimport { made } from \"s\";\n\nexport const thing = { made };\nTS\n\ncat >packages/u/tsconfig.json \u003c\u003c'JSON'\n{\n  \"compilerOptions\": {\n    \"noEmit\": true,\n    \"module\": \"esnext\",\n    \"moduleResolution\": \"bundler\",\n    \"allowImportingTsExtensions\": true,\n    \"strict\": true,\n    \"skipLibCheck\": true\n  },\n  \"include\": [\"src\"],\n  \"references\": [{ \"path\": \"../a\" }]\n}\nJSON\ncat >packages/u/src/index.ts \u003c\u003c'TS'\nimport { thing } from \"a\";\n\nexport const wrong: string = thing.made.x;\nTS\n\necho \"a depends on s; s depends on c; a cannot resolve c.\"\necho \"u assigns a number to a string, so the build must fail.\"\n$tsc -b packages/u\necho \"exit code: $?\"\necho \"packages/a/out/index.d.ts:\"\ncat packages/a/out/index.d.ts\n```\n\n\u003c/details>\n\n### 🙁 Actual behavior\n\n`tsc -b packages/u` exits with 0. The declaration of `a` is:\n\n```ts\nexport declare const thing: {\n    made: import(\"c/Thing\").Thing;\n};\n```\n\n`c/Thing` cannot be resolved from `packages/a`. The consumer `u` reads `Thing` as `any`, so `const wrong: string = thing.made.x` is accepted although `x` is a number. `skipLibCheck` hides the failed import; with `skipLibCheck: false` the same build reports `packages/a/out/index.d.ts(2,18): error TS2307: Cannot find module 'c/Thing'`.\n\n### 🙂 Expected behavior\n\nTS2883 at `thing` in `packages/a/src/index.ts`. That is what all three versions report for the same layout when `c` has `\"types\": \"index.d.ts\"` and no `exports` map:\n\n```\npackages/a/src/index.ts(3,14): error TS2883: The inferred type of 'thing' cannot be named without a reference to 'Thing' from '../../s/node_modules/c'. This is likely not portable. A type annotation is necessary.\n```\n\n### Additional information about the issue\n\n- In 7.0.2, `tryGetModuleNameAsNodeModule` (`internal/modulespecifiers/specifiers.go`, about line 786) returns the specifier as soon as it comes verbatim from the package's `exports` (`if verbatimFromExports { return moduleFileToTry }`). That return is before the check that the top-level `node_modules` directory is an ancestor of the importing file, which is the check that gives an empty result, and so TS2883, in the case with no `exports` map.\n- How we found it: a workspace package had `import(\"@effect/sql-pg/PgClient\").PgClient` in a declaration and did not depend on `@effect/sql-pg`. Its consumers read a layer's requirements as `any`.\n","author":{"url":"https://github.com/kristojorg","@type":"Person","name":"kristojorg"},"datePublished":"2026-10-02T13:43:41Z","url":"https://github.com/microsoft/TypeScript/issues/64590"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:407b3bc3-dce9-23dd-b8ee-8a471be07dcf
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE56E:1087D4:9B2EE9:D06522:6B00EBD3
html-safe-noncef1966063a604aeec6a545f70da754956ade15444ef98bfe0b24a4f6689c57df4
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNTZFOjEwODdENDo5QjJFRTk6RDA2NTIyOjZCMDBFQkQzIiwidmlzaXRvcl9pZCI6IjU2NzExNTY2MTI3OTA4MDc1MDciLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ==
visitor-hmacd8ca2b0568749eac99f2aff11cabc83aed6ab359abac5460ab881b7b854865e3
hovercard-subject-tagissue:5678285184
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/64590/issue_layout
twitter:imagehttps://opengraph.githubassets.com/f7a242d1cd1f583d628ccec86da93e2df8fe448cbac46e83dad9f75e84e0ac07/microsoft/TypeScript/issues/64590
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/f7a242d1cd1f583d628ccec86da93e2df8fe448cbac46e83dad9f75e84e0ac07/microsoft/TypeScript/issues/64590
og:image:alt🔎 Search Terms TS2883, TS2742, cannot be named without a reference, not portable, declaration emit module specifier, exports map, pnpm, import type cannot be resolved, skipLibCheck any 🕗 Version & ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamekristojorg
hostnamegithub.com
expected-hostnamegithub.com
None4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc
turbo-cache-controlno-preview
go-importgithub.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git
octolytics-dimension-user_id6154722
octolytics-dimension-user_loginmicrosoft
octolytics-dimension-repository_id20929025
octolytics-dimension-repository_nwomicrosoft/TypeScript
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id20929025
octolytics-dimension-repository_network_root_nwomicrosoft/TypeScript
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release9983dd5da06943f833c971dd5b6bc988e2858be5
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/64590#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F64590
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F64590
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=microsoft%2FTypeScript
Reloadhttps://github.com/microsoft/TypeScript/issues/64590
Reloadhttps://github.com/microsoft/TypeScript/issues/64590
Reloadhttps://github.com/microsoft/TypeScript/issues/64590
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests308 (308)https://github.com/microsoft/TypeScript/pulls
Actionshttps://github.com/microsoft/TypeScript/actions
Projectshttps://github.com/microsoft/TypeScript/projects
Wikihttps://github.com/microsoft/TypeScript/wiki
Security and qualityhttps://github.com/microsoft/TypeScript/security
Insightshttps://github.com/microsoft/TypeScript/insights
https://github.com/microsoft/TypeScript
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/64590
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/64590
#64599https://github.com/microsoft/TypeScript/pull/64599
kestra-io/kestra#22375https://github.com/kestra-io/kestra/pull/22375
Declaration emit writes an import the file cannot resolve when the package has exports; no TS2883https://github.com/microsoft/TypeScript/issues/64590#top
#64599https://github.com/microsoft/TypeScript/pull/64599
kestra-io/kestra#22375https://github.com/kestra-io/kestra/pull/22375
https://github.com/weswigham
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
TypeScript 7.1.1 RChttps://github.com/microsoft/TypeScript/milestone/225
https://github.com/kristojorg
Kristo Jorgenson (kristojorg)https://github.com/kristojorg
on Oct 2, 2026https://github.com/microsoft/TypeScript/issues/64590#issue-5678285184
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
on Oct 6, 2026https://github.com/microsoft/TypeScript/issues/64590#event-32643606656
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 7.1.1 RChttps://github.com/microsoft/TypeScript/milestone/225
on Oct 6, 2026https://github.com/microsoft/TypeScript/issues/64590#event-32643607567
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Wesley Wigham (weswigham)https://github.com/weswigham
on Oct 6, 2026https://github.com/microsoft/TypeScript/issues/64590#event-32643608704
Wesley Wigham (weswigham)https://github.com/weswigham
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#64599https://github.com/microsoft/TypeScript/pull/64599
on Oct 12, 2026https://github.com/microsoft/TypeScript/issues/64590#event-33069465106
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/64590
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/64590
Wesley Wigham (weswigham)https://github.com/weswigham
BugA bug in TypeScripthttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Bug%22
TypeScript 7.1.1 RCNo due datehttps://github.com/microsoft/TypeScript/milestone/225
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.