René's URL Explorer Experiment


Title: Re-exporting CJS module with `export =` from ESM via `export *` causes type error · Issue #51923 · microsoft/TypeScript · GitHub

Open Graph Title: Re-exporting CJS module with `export =` from ESM via `export *` causes type error · Issue #51923 · microsoft/TypeScript

X Title: Re-exporting CJS module with `export =` from ESM via `export *` causes type error · Issue #51923 · microsoft/TypeScript

Description: Bug Report TypeScript raises diagnostics when re-exporting a cjs package whose type declaration is defined with export = via export * in an ES module. 🔎 Search Terms "'export =' and cannot be used with 'export *'" 🕗 Version & Regression ...

Open Graph Description: Bug Report TypeScript raises diagnostics when re-exporting a cjs package whose type declaration is defined with export = via export * in an ES module. 🔎 Search Terms "'export =' and cannot be used ...

X Description: Bug Report TypeScript raises diagnostics when re-exporting a cjs package whose type declaration is defined with export = via export * in an ES module. 🔎 Search Terms "'export =' and ca...

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

X: @github

direct link

Domain: github.com

IPv4 address: 140.82.114.3


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Re-exporting CJS module with `export =` from ESM via `export *` causes type error","articleBody":"# Bug Report\r\n\r\nTypeScript raises diagnostics when re-exporting a cjs package whose type declaration is defined with `export =` via `export *` in an ES module.\r\n\r\n### 🔎 Search Terms\r\n\r\n- \"'export =' and cannot be used with 'export *'\"\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n5.0.0-dev.20221216\r\n\r\n### ⏯ Playground Link\r\n\r\nN/A - multiple files\r\n\r\n### 💻 Code\r\n\r\n1. `mkdir scratch && cd scratch`\r\n1. `npm init -y`\r\n1. `npm i react @types/react typescript@next`\r\n1. tsconfig.json\r\n    ```json\r\n    {\r\n      \"compilerOptions\": {\r\n        \"target\": \"ESNext\",\r\n        \"moduleResolution\": \"NodeNext\",\r\n        \"strict\": true\r\n       }\r\n    }\r\n    ```\r\n1. react.mts\r\n    ```ts\r\n    export * from \"react\";\r\n\r\n    // notice this import is fine and does not error\r\n    import { useCallback } from \"react\";\r\n    ```\r\n1. main.mts\r\n    ```ts\r\n    import { useCallback } from \"./react.mjs\";\r\n    console.log(useCallback);\r\n    ```\r\n\r\n### 🙁 Actual behavior\r\n\r\nTry type checking & emitting:\r\n\r\n```\r\n> npx tsc\r\nmain.mts:1:10 - error TS2305: Module '\"./react.mjs\"' has no exported member 'useCallback'.\r\n\r\n1 import { useCallback } from \"./react.mjs\";\r\n           ~~~~~~~~~~~\r\n\r\nreact.mts:1:15 - error TS2498: Module '\"V:/scratch-npm/node_modules/@types/react/index\"' uses 'export =' and cannot be used with 'export *'.\r\n\r\n1 export * from \"react\";\r\n                ~~~~~~~\r\n\r\n\r\nFound 2 errors in 2 files.\r\n\r\nErrors  Files\r\n     1  main.mts:1\r\n     1  react.mts:1\r\n```\r\n\r\nIt will emit, so try running it and see that it works:\r\n\r\n```\r\n> node main.mjs\r\n[Function: useCallback]\r\n```\r\n\r\n### 🙂 Expected behavior\r\n\r\nShould type check fine because this works at runtime and `export =` matches the runtime code which has a single `module .exports = ...` assignment.","author":{"url":"https://github.com/dsherret","@type":"Person","name":"dsherret"},"datePublished":"2022-12-16T18:28:08Z","url":"https://github.com/microsoft/TypeScript/issues/51923"}

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:868ba0b6-0cf3-2bcc-2f0e-7e5cbb9ccdc9
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idE462:2876DA:1F17E7B:288F192:6B0534A0
html-safe-nonceaba5ccabb5620993399e2e7e1a273d306f76ff812a204868cfb7531e7a007ac7
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFNDYyOjI4NzZEQToxRjE3RTdCOjI4OEYxOTI6NkIwNTM0QTAiLCJ2aXNpdG9yX2lkIjoiMTE3OTg2MTMxMDgwOTM4ODE5MiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac77cac6be80192afedc32b04e30eaaac7169c4af568a531185c435f8f1dadc933
hovercard-subject-tagissue:1500679263
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/51923/issue_layout
twitter:imagehttps://opengraph.githubassets.com/d291834271dfc26002b8ca2a0891c0c5a7e0f9b76afd257d38c9c0934b4933e8/microsoft/TypeScript/issues/51923
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/d291834271dfc26002b8ca2a0891c0c5a7e0f9b76afd257d38c9c0934b4933e8/microsoft/TypeScript/issues/51923
og:image:altBug Report TypeScript raises diagnostics when re-exporting a cjs package whose type declaration is defined with export = via export * in an ES module. 🔎 Search Terms "'export =' and cannot be used ...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamedsherret
hostnamegithub.com
expected-hostnamegithub.com
None854d880890b5e847b3fce9d1b31f032107baeddeebad2aa379c48aa4f1451f6b
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
release220e980097d94ce616d5d11fbd5316d208e3fc93
ui-targetfull
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/microsoft/TypeScript/issues/51923#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fmicrosoft%2FTypeScript%2Fissues%2F51923
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%2F51923
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/51923
Reloadhttps://github.com/microsoft/TypeScript/issues/51923
Reloadhttps://github.com/microsoft/TypeScript/issues/51923
microsofthttps://github.com/microsoft
TypeScripthttps://github.com/microsoft/TypeScript
Codehttps://github.com/microsoft/TypeScript
Issues5k (5k)https://github.com/microsoft/TypeScript/issues
Pull requests321 (321)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/51923
New issuehttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/51923
Re-exporting CJS module with export = from ESM via export * causes type errorhttps://github.com/microsoft/TypeScript/issues/51923#top
https://github.com/weswigham
Needs Investigationhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Investigation%22
https://github.com/dsherret
David Sherret (dsherret)https://github.com/dsherret
on Dec 16, 2022https://github.com/microsoft/TypeScript/issues/51923#issue-1500679263
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Needs Investigationhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Investigation%22
on Dec 16, 2022https://github.com/microsoft/TypeScript/issues/51923#event-8060257159
Ryan Cavanaugh (RyanCavanaugh)https://github.com/RyanCavanaugh
Wesley Wigham (weswigham)https://github.com/weswigham
on Dec 16, 2022https://github.com/microsoft/TypeScript/issues/51923#event-8060257388
https://github.com/weswigham
Wesley Wigham (weswigham)https://github.com/weswigham
on Jan 3, 2023https://github.com/microsoft/TypeScript/issues/51923#issuecomment-1370192652
omega oldhttps://github.com/microsoft/TypeScript/pull/2460
https://github.com/dsherret
David Sherret (dsherret)https://github.com/dsherret
on Jan 3, 2023https://github.com/microsoft/TypeScript/issues/51923#issuecomment-1370247020
kyle (kylejeske)https://github.com/kylejeske
on Jun 7, 2023https://github.com/microsoft/TypeScript/issues/51923#event-9451979876
fix: explicit type exporthttps://github.com/electrode-io/fastify-server/commit/e2b30d11c64823d1699a99a9563aa0aec076aca9
e2b30d1https://github.com/electrode-io/fastify-server/commit/e2b30d11c64823d1699a99a9563aa0aec076aca9
fix: explicit type export (#33)https://github.com/electrode-io/fastify-server/commit/63ca4600021512a30c57164d6855dd32173f60df
#33https://github.com/electrode-io/fastify-server/pull/33
63ca460https://github.com/electrode-io/fastify-server/commit/63ca4600021512a30c57164d6855dd32173f60df
Sign up for freehttps://github.com/signup?return_to=https://github.com/microsoft/TypeScript/issues/51923
Sign in to commenthttps://github.com/login?return_to=https://github.com/microsoft/TypeScript/issues/51923
Wesley Wigham (weswigham)https://github.com/weswigham
Needs Investigationhttps://github.com/microsoft/TypeScript/issues?q=state%3Aopen%20label%3A%22Needs%20Investigation%22
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

Response headers:
Servergithub.com
Content-Typetext/html; charset=utf-8
Cache-Controlmax-age=0, private, must-revalidate

Viewport: width=device-width


URLs of crawlers that visited me.