Title: Invalid type definitions generated when imported classes have same name · Issue #55375 · microsoft/TypeScript · GitHub
Open Graph Title: Invalid type definitions generated when imported classes have same name · Issue #55375 · microsoft/TypeScript
X Title: Invalid type definitions generated when imported classes have same name · Issue #55375 · microsoft/TypeScript
Description: 🔎 Search Terms type definitions invalid name 🕗 Version & Regression Information This is the behavior since TypeScript 4.0, worked in 3.9.10 ⏯ Playground Link https://github.com/MoonE/ts-types-bug 💻 Code test/Test.js /** @module test/Test...
Open Graph Description: 🔎 Search Terms type definitions invalid name 🕗 Version & Regression Information This is the behavior since TypeScript 4.0, worked in 3.9.10 ⏯ Playground Link https://github.com/MoonE/ts-types-bug 💻...
X Description: 🔎 Search Terms type definitions invalid name 🕗 Version & Regression Information This is the behavior since TypeScript 4.0, worked in 3.9.10 ⏯ Playground Link https://github.com/MoonE/ts-types-b...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/55375
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Invalid type definitions generated when imported classes have same name","articleBody":"### 🔎 Search Terms\r\n\r\ntype definitions invalid name\r\n\r\n### 🕗 Version & Regression Information\r\n\r\n- This is the behavior since TypeScript 4.0, worked in 3.9.10\r\n\r\n\r\n### ⏯ Playground Link\r\n\r\nhttps://github.com/MoonE/ts-types-bug\r\n\r\n### 💻 Code\r\n\r\n> test/Test.js\r\n```js\r\n/** @module test/Test */\r\nclass Test {}\r\nexport default Test;\r\n```\r\n> Test.js\r\n```js\r\n/** @module Test */\r\nclass Test {}\r\nexport default Test;\r\n```\r\n> X.js\r\n```js\r\nimport Test from './test/Test.js'\r\n\r\n/**\r\n * @typedef {Object} Options\r\n * @property {typeof import(\"./Test.js\").default} [test]\r\n */\r\n\r\nclass X extends Test {\r\n /**\r\n * @param {Options} options\r\n */\r\n constructor(options) {\r\n super();\r\n if (options.test) {\r\n this.test = new options.test();\r\n }\r\n }\r\n}\r\n\r\nexport default X;\r\n```\r\n\r\n\r\n### 🙁 Actual behavior\r\n\r\nIn the generate file there is a reference to a wrong class name (`Test_1`)\r\n> X.d.ts\r\n```ts\r\nexport default X;\r\nexport type Options = {\r\n test?: typeof import(\"./Test.js\").default | undefined;\r\n};\r\n/**\r\n * @typedef {Object} Options\r\n * @property {typeof import(\"./Test.js\").default} [test]\r\n */\r\ndeclare class X extends Test {\r\n /**\r\n * @param {Options} options\r\n */\r\n constructor(options: Options);\r\n test: import(\"./Test.js\").default | undefined;\r\n}\r\nimport Test_1 from './test/Test.js';\r\n//# sourceMappingURL=X.d.ts.map\r\n```\r\n\r\n### 🙂 Expected behavior\r\n\r\nThe class in the import statement should be named `Test`.","author":{"url":"https://github.com/MoonE","@type":"Person","name":"MoonE"},"datePublished":"2023-08-14T20:14:47Z","url":"https://github.com/microsoft/TypeScript/issues/55375"}
| 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:957ee6b9-9827-ec2e-37ad-d555930310e0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 87CE:1AE20C:1EDFCB9:2710FAC:6B016152 |
| html-safe-nonce | eaf6d20e99544d9a52fde3a04f71ec7077a9d61da1c2e8571162aaed79757a60 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4N0NFOjFBRTIwQzoxRURGQ0I5OjI3MTBGQUM6NkIwMTYxNTIiLCJ2aXNpdG9yX2lkIjoiMTA4MTU2ODM4MTQ4OTk5NjExNSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | e81d08e83b903959ee9f95346b96e2a0cbd0cf3f22ca427105e8020ceba28c37 |
| hovercard-subject-tag | issue:1850472574 |
| 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/55375/issue_layout |
| twitter:image | https://opengraph.githubassets.com/b0a7230fdaa76a9802f9335409605a0783d7e1b33707ef8b62096bc609076828/microsoft/TypeScript/issues/55375 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/b0a7230fdaa76a9802f9335409605a0783d7e1b33707ef8b62096bc609076828/microsoft/TypeScript/issues/55375 |
| og:image:alt | 🔎 Search Terms type definitions invalid name 🕗 Version & Regression Information This is the behavior since TypeScript 4.0, worked in 3.9.10 ⏯ Playground Link https://github.com/MoonE/ts-types-bug 💻... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | MoonE |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width