René's URL Explorer Experiment


Title: Pulling in ambient types through triple slash directive stopped working when exports field present on package.json · Issue #46860 · microsoft/TypeScript · GitHub

Open Graph Title: Pulling in ambient types through triple slash directive stopped working when exports field present on package.json · Issue #46860 · microsoft/TypeScript

X Title: Pulling in ambient types through triple slash directive stopped working when exports field present on package.json · Issue #46860 · microsoft/TypeScript

Description: Bug Report 🔎 Search Terms tripleslash ambient types 🕗 Version & Regression Information This changed between the latest version o 4.4 and 4.5.2 ⏯ Playground Link Not possible to show in the playground 💻 Code global.d.ts ///

Open Graph Description: Bug Report 🔎 Search Terms tripleslash ambient types 🕗 Version & Regression Information This changed between the latest version o 4.4 and 4.5.2 ⏯ Playground Link Not possible to show in the playgrou...

X Description: Bug Report 🔎 Search Terms tripleslash ambient types 🕗 Version & Regression Information This changed between the latest version o 4.4 and 4.5.2 ⏯ Playground Link Not possible to show in the play...

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Pulling in ambient types through triple slash directive stopped working when exports field present on package.json","articleBody":"# Bug Report\r\n\r\n### 🔎 Search Terms\r\n\r\ntripleslash ambient types\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n- This changed between the latest version o 4.4 and 4.5.2\r\n\r\n### ⏯ Playground Link\r\n\r\nNot possible to show in the playground\r\n\r\n### 💻 Code\r\n`global.d.ts`\r\n```ts\r\n/// \u003creference types=\"svelte\" />\r\n```\r\n\r\n### 🙁 Actual behavior\r\n\r\nSince 4.5 referencing types via triple slash directives in an ambient module to pull in other ambient types into the global scope stopped working when the package whose types should be pulled in has `exports` defined in their `package.json`, but no `types` field inside `exports`. \r\n\r\n### 🙂 Expected behavior\r\n\r\nReferencing types via triple slash directives should pull in their ambient types into the global scope\r\n\r\n### Steps to reproduce\r\n\r\nThis is reproducible using the Svelte starter template which uses this technique to tell TypeScript to treat any file import ending with `.svelte` as valid, resolving it to an ambient module named `*.svelte`.\r\n\r\n1. Clone https://github.com/sveltejs/template, for example through `npx degit sveltejs/template svelte-app`\r\n2. `cd svelte-app/ && node scripts/setupTypeScript.js` - this converts the template to using TS\r\n3. In the `package.json` pin the `svelte` version to `3.44.1` (the last version where this occurs, we since added a fix on our side, but I still think this a TS bug)\r\n4. `npm install`\r\n5. Open project in VS Code and set TS to use the workspace TS version\r\n6. Open `main.ts` --> bug: `import App from './Apps.svelte';` has an error because the triple slash directive in `global.d.ts` doesn't work\r\n\r\nIf I change the triple slash directive in `global.d.ts` to `/// \u003creference path=\"../node_modules/svelte/types/runtime/index.d.ts\" />` it works. That path reference is what the `types` field in the `package.json` of Svelte resolves to, so I would expect `/// \u003creference types=\"svelte\" />` to work.\r\n\r\nMy guess is that this is a side effect of the new Node12 mode which was part of the 4.5 beta releases but was then pulled out of the final release. With that new mode it would be expected to have a corresponding `types` entry as part of the `exports` in Svelte's `package.json`, but since that new resolution isn't used I would expect the types to get resolved like in 4.4 and downwards. In fact, I just tested this out and it indeed works in 4.5 using `/// \u003creference types=\"svelte\" />` if `types` is part of the `exports` in `package.json`.\r\n\r\nI guess this not only impacts the Svelte starter template but every package which has `exports` without `types` in it and wants to support loading definitions into the global scope through tripleslash directives.","author":{"url":"https://github.com/dummdidumm","@type":"Person","name":"dummdidumm"},"datePublished":"2021-11-18T22:06:28Z","url":"https://github.com/microsoft/TypeScript/issues/46860"}

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:00a34537-96b4-644c-191f-14fae0a1c7ea
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idCBD0:27D3AD:D0C100:10A0D19:6B010090
html-safe-nonce48d2328cfa3da345d01af6b833c07493ddd09806103dae28e81fcffad291f1e8
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDQkQwOjI3RDNBRDpEMEMxMDA6MTBBMEQxOTo2QjAxMDA5MCIsInZpc2l0b3JfaWQiOiI0NTM2MDE5NzczMTg3NzUyMDgwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0=
visitor-hmac59517bacd391501467495e90cf4f15a82246b922a7166f315171b12d7b747f61
hovercard-subject-tagissue:1057867585
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/46860/issue_layout
twitter:imagehttps://opengraph.githubassets.com/5d96bdacd13adacc9494007af5094c16eaad5a33ebfea73c3ae5e955a2cfce77/microsoft/TypeScript/issues/46860
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/5d96bdacd13adacc9494007af5094c16eaad5a33ebfea73c3ae5e955a2cfce77/microsoft/TypeScript/issues/46860
og:image:altBug Report 🔎 Search Terms tripleslash ambient types 🕗 Version & Regression Information This changed between the latest version o 4.4 and 4.5.2 ⏯ Playground Link Not possible to show in the playgrou...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedummdidumm
hostnamegithub.com
expected-hostnamegithub.com
Nonecb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124
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
release2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/46860#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F46860
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%2F46860
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/46860
Reloadhttps://github.com/microsoft/TypeScript/issues/46860
Reloadhttps://github.com/microsoft/TypeScript/issues/46860
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests309 (309)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/46860
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/46860
#47007https://github.com/microsoft/TypeScript/pull/47007
Pulling in ambient types through triple slash directive stopped working when exports field present on package.jsonhttps://github.com/microsoft/TypeScript/issues/46860#top
#47007https://github.com/microsoft/TypeScript/pull/47007
https://github.com/weswigham
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%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
TypeScript 4.5.3https://github.com/microsoft/TypeScript/milestone/154
https://github.com/dummdidumm
Simon H (dummdidumm)https://github.com/dummdidumm
on Nov 18, 2021https://github.com/microsoft/TypeScript/issues/46860#issue-1057867585
https://github.com/sveltejs/templatehttps://github.com/sveltejs/template
Simon H (dummdidumm)https://github.com/dummdidumm
on Nov 18, 2021https://github.com/microsoft/TypeScript/issues/46860#event-5641785933
(fix) add types field to exportshttps://github.com/sveltejs/svelte/commit/2bf5b7bd988036aa9fa0e5e186674273d1078071
2bf5b7bhttps://github.com/sveltejs/svelte/commit/2bf5b7bd988036aa9fa0e5e186674273d1078071
[fix] add types field to exports (#6937)https://github.com/sveltejs/svelte/commit/eaa9ffa3307b3f95fd1b66884069af9dd031462e
#6937https://github.com/sveltejs/svelte/pull/6937
eaa9ffahttps://github.com/sveltejs/svelte/commit/eaa9ffa3307b3f95fd1b66884069af9dd031462e
Harminder Virk (thetutlage)https://github.com/thetutlage
on Nov 21, 2021https://github.com/microsoft/TypeScript/issues/46860#event-5649783502
fix: Resolve types with TypeScript 4.5https://github.com/adonisjs/core/commit/ffa16107e3efd09ffef71058c1ddb4cebbdf3660
ffa1610https://github.com/adonisjs/core/commit/ffa16107e3efd09ffef71058c1ddb4cebbdf3660
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
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
on Nov 22, 2021https://github.com/microsoft/TypeScript/issues/46860#event-5656864359
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Wesley Wigham (weswigham)https://github.com/weswigham
on Nov 22, 2021https://github.com/microsoft/TypeScript/issues/46860#event-5656864644
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
TypeScript 4.6.0https://github.com/microsoft/TypeScript/milestone/151
on Nov 22, 2021https://github.com/microsoft/TypeScript/issues/46860#event-5656864742
TypeScript Bot (typescript-bot)https://github.com/typescript-bot
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%22
on Dec 3, 2021https://github.com/microsoft/TypeScript/issues/46860#event-5713987093
Wesley Wigham (weswigham)https://github.com/weswigham
completedhttps://github.com/microsoft/TypeScript/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
#47007https://github.com/microsoft/TypeScript/pull/47007
on Dec 4, 2021https://github.com/microsoft/TypeScript/issues/46860#event-5715598860
Daniel Rosenwasser (DanielRosenwasser)https://github.com/DanielRosenwasser
TypeScript 4.6.0https://github.com/microsoft/TypeScript/milestone/151
TypeScript 4.5.3https://github.com/microsoft/TypeScript/milestone/154
on Dec 7, 2021https://github.com/microsoft/TypeScript/issues/46860#event-5730488110
Hakula Chen (hakula139)https://github.com/hakula139
on Dec 22, 2021https://github.com/microsoft/TypeScript/issues/46860#event-5802860535
build: upgrade typescript versionhttps://github.com/hakula139/careecuz-frontend/commit/6920e33e7d37b93af394f188b592b478a08a084c
6920e33https://github.com/hakula139/careecuz-frontend/commit/6920e33e7d37b93af394f188b592b478a08a084c
fix: fix intellisense for env variableshttps://github.com/hakula139/vue-ts-app-template/commit/f67266b6fa9634b94f091f880866f540db2d78ba
f67266bhttps://github.com/hakula139/vue-ts-app-template/commit/f67266b6fa9634b94f091f880866f540db2d78ba
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/46860
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/46860
Wesley Wigham (weswigham)https://github.com/weswigham
Fix AvailableA PR has been opened for this issuehttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Fix%20Available%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
TypeScript 4.5.3https://github.com/microsoft/TypeScript/milestone/154
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.