René's URL Explorer Experiment


Title: Module resolution via "--paths" fails against declaration files generated alongside "--outfile:" · Issue #18311 · microsoft/TypeScript · GitHub

Open Graph Title: Module resolution via "--paths" fails against declaration files generated alongside "--outfile:" · Issue #18311 · microsoft/TypeScript

X Title: Module resolution via "--paths" fails against declaration files generated alongside "--outfile:" · Issue #18311 · microsoft/TypeScript

Description: TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx) 2.5.2 Code /bundles - app.js - app.d.ts - common.js - common.d.ts - core.js - core.d.ts /app - main.ts - tsconfig.ts /src/common - index.ts - file1.ts - tsconfig.json /src/core - i...

Open Graph Description: TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx) 2.5.2 Code /bundles - app.js - app.d.ts - common.js - common.d.ts - core.js - core.d.ts /app - main.ts - tsconfig.ts /src/common - index.ts ...

X Description: TypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx) 2.5.2 Code /bundles - app.js - app.d.ts - common.js - common.d.ts - core.js - core.d.ts /app - main.ts - tsconfig.ts /src/common - index.ts ...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Module resolution via \"--paths\" fails against declaration files generated alongside \"--outfile:\"","articleBody":"**TypeScript Version:**  2.4.0 / nightly (2.5.0-dev.201xxxxx)\r\n2.5.2\r\n**Code**\r\n\r\n```\r\n/bundles\r\n- app.js\r\n- app.d.ts\r\n- common.js\r\n- common.d.ts\r\n- core.js\r\n- core.d.ts\r\n\r\n/app\r\n- main.ts\r\n- tsconfig.ts\r\n\r\n/src/common\r\n- index.ts\r\n- file1.ts\r\n- tsconfig.json\r\n\r\n/src/core\r\n- index.ts\r\n- file1.ts\r\n- tsconfig.json\r\n\r\n//app/main.ts\r\nimport { resource } from '@bundles/core'\r\nimport { somethingElse } from '@bundles/common'\r\n\r\n//common/index.ts\r\nexport * from './file1.ts'\r\n\r\n//core/index.ts\r\nexport * from './file1.ts'\r\n\r\n//app/tsconfig.json\r\n...\r\n\"target\": \"es5\",\r\n\"module\": \"system\",\r\n\"rootDir\": \".\",\r\n\"outFile\": \"../bundles/app.js\",\r\n\"declarations\": true,\r\n\"paths\": {\r\n   \"@bundles/*\": [\"../bundles/*\"]\r\n}\r\n...\r\n\r\n//common/tsconfig.json\r\n...\r\n\"target\": \"es5\",\r\n\"module\": \"system\",\r\n\"rootDir\": \".\",\r\n\"outFile\": \"../bundles/common.js\",\r\n\"declarations\": true,\r\n\"paths\": {\r\n   \"@bundles/*\": [\"../bundles/*\"]\r\n}\r\n...\r\n\r\n//core/tsconfig.json\r\n...\r\n\"target\": \"es5\",\r\n\"module\": \"system\",\r\n\"rootDir\": \".\",\r\n\"outFile\": \"../bundles/core.js\",\r\n\"declarations\": true\r\n\"paths\": {\r\n   \"@bundles/*\": [\"../bundles/*\"]\r\n}\r\n\r\n// bundles/common.d.ts\r\ndeclare module \"index\" {\r\n    export * from 'file1'\r\n}\r\n\r\n// bundles/core.d.ts\r\ndeclare module \"index\" {\r\n    export * from 'file1'\r\n}\r\n...\r\n```\r\n\r\n\r\n\r\n**Expected behavior:**\r\nTSC to correctly resolve the import statements within `app/main.ts` against the configured `--paths`, applying the same logical resolution strategy that lets it resolve barrels.\r\n\r\n(note: I've had to escape the [@] symbols for some reason at the start of these lines).\r\n\r\n```\r\n\"[@]bundles/common\" => '../bundles/common.d.ts' => '../bundles/common.d.ts [declared module \"index\"]'   (OK)\r\n\r\n\"[@]bundles/core\" => '../bundles/core.d.ts' => '../bundles/core.d.ts [declared module \"index\"]'   (OK)\r\n\r\n\"[@]bundles/*\" => '../bundles/*.d.ts  => \"[declared module *]\" => \"[declared module index]\"  => \"../bundles/*/index.d.ts\" => \"[declared module *]\" => \"[declared module index]\"\r\n```\r\n  \r\n**Actual behavior:**\r\n\r\nIt appears the path part of the import statement is currently expected to be included in the declared module name.\r\n\r\n```\r\n\"[@]bundles/common\" => '../bundles/common.d.ts' => '../bundles/common.d.ts [declared module \"@bundles/common\"]'   (FAIL)\r\n```\r\n\r\nEven if I name` index.ts` to `common.ts` for example, this will still fail because the resolution logic is expecting the `\"@bundles\"` path token to be in the declared module name. \r\n\r\nI can coerce the expected behavior by creating a \"@bundles\" folder inside my module - but the whole point is that the \"--paths\" option shouldn't be married to the module structure. \r\n\r\n```\r\n/src/common\r\n- @bundles/\r\n-- common.ts\r\n\r\n//src/common/@bundles/common.ts\r\nexport * from '../index'\r\n\r\n//bundles/common.d.ts\r\ndeclare module \"index\" {\r\n  exports \"file1\r\n}\r\n\r\ndeclare module \"@bundles/common\" {\r\n   exports \"index\"\r\n}\r\n```","author":{"url":"https://github.com/josh-sachs","@type":"Person","name":"josh-sachs"},"datePublished":"2017-09-07T14:49:47Z","url":"https://github.com/microsoft/TypeScript/issues/18311"}

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:3c138bd2-dd9c-37a1-0a46-d93f18d36465
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9432:2D2F2F:CE25B9:10B02B7:6B00F191
html-safe-nonce188b6d612176bf666aa0eaf75cfaffa302b32058d093785a3280cd2139061752
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NDMyOjJEMkYyRjpDRTI1Qjk6MTBCMDJCNzo2QjAwRjE5MSIsInZpc2l0b3JfaWQiOiI2NzIwNjYyMDE3OTQzODU5NjAxIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac7310db05b928a45074aa4eb1b5abb76a93941753858199b55520c99ead0771d2
hovercard-subject-tagissue:255963917
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/18311/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5f5bbdfb3b1b27a2e94163a9263e327ece058f0414bb13ed43be3093ba876f1c/microsoft/TypeScript/issues/18311
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5f5bbdfb3b1b27a2e94163a9263e327ece058f0414bb13ed43be3093ba876f1c/microsoft/TypeScript/issues/18311
og:image:altTypeScript Version: 2.4.0 / nightly (2.5.0-dev.201xxxxx) 2.5.2 Code /bundles - app.js - app.d.ts - common.js - common.d.ts - core.js - core.d.ts /app - main.ts - tsconfig.ts /src/common - index.ts ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejosh-sachs
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/18311#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F18311
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%2F18311
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/18311
Reloadhttps://github.com/microsoft/TypeScript/issues/18311
Reloadhttps://github.com/microsoft/TypeScript/issues/18311
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/18311
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/18311
Module resolution via "--paths" fails against declaration files generated alongside "--outfile:"https://github.com/microsoft/TypeScript/issues/18311#top
Working as IntendedThe behavior described is the intended behavior; this is not a bughttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Working%20as%20Intended%22
TypeScript 4.1.0https://github.com/microsoft/TypeScript/milestone/124
https://github.com/josh-sachs
Joshua Sachs (josh-sachs)https://github.com/josh-sachs
on Sep 7, 2017https://github.com/microsoft/TypeScript/issues/18311#issue-255963917
Bundles (@bundles)https://github.com/bundles
Nexthttps://github.com/microsoft/TypeScript/issues/18311?timeline_page=1
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 7, 2017https://github.com/microsoft/TypeScript/issues/18311#issuecomment-327884760
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
Needs More InfoThe issue still hasn't been fully clarifiedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20More%20Info%22
on Sep 7, 2017https://github.com/microsoft/TypeScript/issues/18311#event-1239345869
https://github.com/josh-sachs
Joshua Sachs (josh-sachs)https://github.com/josh-sachs
on Sep 7, 2017https://github.com/microsoft/TypeScript/issues/18311#issuecomment-327919090
https://github.com/josh-sachs/typescript-18311https://github.com/josh-sachs/typescript-18311
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 7, 2017https://github.com/microsoft/TypeScript/issues/18311#issuecomment-327924376
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
QuestionAn issue which isn't directly actionable in codehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Question%22
Needs More InfoThe issue still hasn't been fully clarifiedhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20More%20Info%22
on Sep 7, 2017https://github.com/microsoft/TypeScript/issues/18311#event-1239577304
https://github.com/josh-sachs
Joshua Sachs (josh-sachs)https://github.com/josh-sachs
on Sep 7, 2017https://github.com/microsoft/TypeScript/issues/18311#issuecomment-327928787
https://github.com/josh-sachs
Joshua Sachs (josh-sachs)https://github.com/josh-sachs
on Sep 10, 2017https://github.com/microsoft/TypeScript/issues/18311#issuecomment-328354961
Mohamed Hegazy (@mhegazy)https://github.com/mhegazy
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 11, 2017https://github.com/microsoft/TypeScript/issues/18311#issuecomment-328600543
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 11, 2017https://github.com/microsoft/TypeScript/issues/18311#issuecomment-328600619
http://www.typescriptlang.org/docs/handbook/modules.htmlhttp://www.typescriptlang.org/docs/handbook/modules.html
https://github.com/josh-sachs
Joshua Sachs (josh-sachs)https://github.com/josh-sachs
on Sep 11, 2017https://github.com/microsoft/TypeScript/issues/18311#issuecomment-328604059
…https://github.com/microsoft/TypeScript/issues/18311
#18311https://github.com/microsoft/TypeScript/issues/18311
http://www.typescriptlang.org/docs/handbook/modules.htmlhttp://www.typescriptlang.org/docs/handbook/modules.html
#18311 (comment)https://github.com/microsoft/TypeScript/issues/18311#issuecomment-328600619
https://github.com/notifications/unsubscribe-auth/ALFAbUlgZK3Flo0z7CUoUSJaFcmzkcSmks5shW5hgaJpZM4PP7kchttps://github.com/notifications/unsubscribe-auth/ALFAbUlgZK3Flo0z7CUoUSJaFcmzkcSmks5shW5hgaJpZM4PP7kc
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 11, 2017https://github.com/microsoft/TypeScript/issues/18311#issuecomment-328606044
https://github.com/josh-sachs
Joshua Sachs (josh-sachs)https://github.com/josh-sachs
on Sep 13, 2017https://github.com/microsoft/TypeScript/issues/18311#issuecomment-329240247
https://www.typescriptlang.org/docs/handbook/module-resolution.htmlhttps://www.typescriptlang.org/docs/handbook/module-resolution.html
https://github.com/mhegazy
Mohamed Hegazy (mhegazy)https://github.com/mhegazy
on Sep 14, 2017https://github.com/microsoft/TypeScript/issues/18311#issuecomment-329614437
https://github.com/josh-sachs
Joshua Sachs (josh-sachs)https://github.com/josh-sachs
on Sep 15, 2017https://github.com/microsoft/TypeScript/issues/18311#issuecomment-329662810
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.0https://github.com/microsoft/TypeScript/milestone/114
on May 1, 2020https://github.com/microsoft/TypeScript/issues/18311#event-3293565675
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.0https://github.com/microsoft/TypeScript/milestone/114
Typescript 4.0.1https://github.com/microsoft/TypeScript/milestone/123
on Jun 29, 2020https://github.com/microsoft/TypeScript/issues/18311#event-3493723637
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
RescheduledThis issue was previously scheduled to an earlier milestonehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Rescheduled%22
on Aug 31, 2020https://github.com/microsoft/TypeScript/issues/18311#event-3710503382
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.0.1https://github.com/microsoft/TypeScript/milestone/123
TypeScript 4.1.0https://github.com/microsoft/TypeScript/milestone/124
on Aug 31, 2020https://github.com/microsoft/TypeScript/issues/18311#event-3710505574
https://github.com/rbuckton
Ron Buckton (rbuckton)https://github.com/rbuckton
on Nov 4, 2020https://github.com/microsoft/TypeScript/issues/18311#issuecomment-721449064
Wesley Wigham (@weswigham)https://github.com/weswigham
Andrew Branch (@andrewbranch)https://github.com/andrewbranch
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Working as IntendedThe behavior described is the intended behavior; this is not a bughttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Working%20as%20Intended%22
Needs InvestigationThis issue needs a team member to investigate its status.https://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Investigation%22
RescheduledThis issue was previously scheduled to an earlier milestonehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Rescheduled%22
on Nov 12, 2020https://github.com/microsoft/TypeScript/issues/18311#event-3990226749
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Ron Buckton (rbuckton)https://github.com/rbuckton
on Nov 12, 2020https://github.com/microsoft/TypeScript/issues/18311#event-3990227005
https://github.com/RyanCavanaugh
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
on Nov 12, 2020https://github.com/microsoft/TypeScript/issues/18311#issuecomment-726278873
Ron Buckton (@rbuckton)https://github.com/rbuckton
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Nov 12, 2020https://github.com/microsoft/TypeScript/issues/18311#event-3990236645
https://github.com/wycats
Yehuda Katz (wycats)https://github.com/wycats
on Feb 2, 2021https://github.com/microsoft/TypeScript/issues/18311#issuecomment-771982095
Ryan Cavanaugh (@RyanCavanaugh)https://github.com/RyanCavanaugh
microsofthttps://github.com/microsoft
on Oct 21, 2025https://github.com/microsoft/TypeScript/issues/18311#event-20415499807
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/18311
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/18311
Working as IntendedThe behavior described is the intended behavior; this is not a bughttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Working%20as%20Intended%22
TypeScript 4.1.0https://github.com/microsoft/TypeScript/milestone/124
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.