Title: [ts-beta 5.5] Function declarations are not exported when targeting commonJS - js emit regression · Issue #58699 · microsoft/TypeScript · GitHub
Open Graph Title: [ts-beta 5.5] Function declarations are not exported when targeting commonJS - js emit regression · Issue #58699 · microsoft/TypeScript
X Title: [ts-beta 5.5] Function declarations are not exported when targeting commonJS - js emit regression · Issue #58699 · microsoft/TypeScript
Description: 🔎 Search Terms JavaScript emit commonjs 🕗 Version & Regression Information This changed between versions 5.4 and 5.5beta ⏯ Playground Link Playground Link 💻 Code function getProgram(source: string) {} export { getProgram } 🙁 Actual behav...
Open Graph Description: 🔎 Search Terms JavaScript emit commonjs 🕗 Version & Regression Information This changed between versions 5.4 and 5.5beta ⏯ Playground Link Playground Link 💻 Code function getProgram(source: string)...
X Description: 🔎 Search Terms JavaScript emit commonjs 🕗 Version & Regression Information This changed between versions 5.4 and 5.5beta ⏯ Playground Link Playground Link 💻 Code function getProgram(source: str...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/58699
X: @github
Domain: github.com
IPv4 address: 140.82.112.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"[ts-beta 5.5] Function declarations are not exported when targeting commonJS - js emit regression ","articleBody":"### 🔎 Search Terms\r\n\r\nJavaScript emit commonjs\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n- This changed between versions 5.4 and 5.5beta\r\n\r\n\r\n### ⏯ Playground Link\r\n\r\n[Playground Link](https://www.typescriptlang.org/play/?moduleResolution=99&target=99&module=1&ts=5.5.0-dev.20240528#code/GYVwdgxgLglg9mABAcwKZQAoCc7KwQwFsAKAZzhCwlQC5FSosYxkBKRAbwF8AoVADwAOcLFE4p02XAUIAaRAGFEXIA)\r\n\r\n### 💻 Code\r\n\r\n```ts\r\nfunction getProgram(source: string) {}\r\nexport { getProgram }\r\n```\r\n\r\n\r\n### 🙁 Actual behavior\r\n\r\nThe following js is generated:\r\n\r\n```js\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.getProgram = void 0;\r\nfunction getProgram(source) { }\r\n```\r\n\r\nThis does not actually add the function to the export. So when importing `getProgram` it will be undefined.\r\n\r\n### 🙂 Expected behavior\r\n\r\nEmit should be the same as 5.4 where the function is actually exported:\r\n\r\n```js\r\nObject.defineProperty(exports, \"__esModule\", { value: true });\r\nexports.getProgram = void 0;\r\nfunction getProgram(source) { }\r\nexports.getProgram = getProgram;\r\n```\r\n\r\n### Additional information about the issue\r\n\r\nThis seems to affect only function declarations. Variables, classes seem to be exported correctly.","author":{"url":"https://github.com/dragomirtitian","@type":"Person","name":"dragomirtitian"},"datePublished":"2024-05-29T16:52:57Z","url":"https://github.com/microsoft/TypeScript/issues/58699"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:539cde9f-02da-326c-b64e-f2728ebc6a1d |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 9D8A:199A0D:34F9E9B:45D0F54:6B0588CD |
| html-safe-nonce | 8f8e4b7122bf05b076f0d7b7608876395162bf950f654427b93c4c0e080db94f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RDhBOjE5OUEwRDozNEY5RTlCOjQ1RDBGNTQ6NkIwNTg4Q0QiLCJ2aXNpdG9yX2lkIjoiODUyNzcxMzUyMjgzNzQ1NzEwMSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5864dc0effa90fea343aaabbce32fbc59f67f4b4c78f5a9cfe6b70c1238b51ba |
| hovercard-subject-tag | issue:2323788727 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/microsoft/TypeScript/58699/issue_layout |
| twitter:image | https://opengraph.githubassets.com/3486963561c23bda86851a5548090912ba9d9bf587f723a3c4c22921dad426b3/microsoft/TypeScript/issues/58699 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/3486963561c23bda86851a5548090912ba9d9bf587f723a3c4c22921dad426b3/microsoft/TypeScript/issues/58699 |
| og:image:alt | 🔎 Search Terms JavaScript emit commonjs 🕗 Version & Regression Information This changed between versions 5.4 and 5.5beta ⏯ Playground Link Playground Link 💻 Code function getProgram(source: string)... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | dragomirtitian |
| hostname | github.com |
| expected-hostname | github.com |
| None | 9b4256ac5f3e310e7945ef5b71c9cb9e264357b1eb20e91d369ed6502a4c486c |
| turbo-cache-control | no-preview |
| go-import | github.com/microsoft/TypeScript git https://github.com/microsoft/TypeScript.git |
| octolytics-dimension-user_id | 6154722 |
| octolytics-dimension-user_login | microsoft |
| octolytics-dimension-repository_id | 20929025 |
| octolytics-dimension-repository_nwo | microsoft/TypeScript |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 20929025 |
| octolytics-dimension-repository_network_root_nwo | microsoft/TypeScript |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | f089e689ad324655ac44bf6cdbc04d976105b374 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
| Server | github.com |
| Content-Type | text/html; charset=utf-8 |
| Cache-Control | max-age=0, private, must-revalidate |
Viewport: width=device-width