Title: TypeScript generates invalid `import` for re-exported types · Issue #26985 · microsoft/TypeScript · GitHub
Open Graph Title: TypeScript generates invalid `import` for re-exported types · Issue #26985 · microsoft/TypeScript
X Title: TypeScript generates invalid `import` for re-exported types · Issue #26985 · microsoft/TypeScript
Description: The issue was reported on #24941 (comment). It was initially discovered in loopbackio/loopback-next#1643. In this case, MetadataAccessor is exported from @loopback/metadata and re-exported by @loopback/context. Please note that @loopback...
Open Graph Description: The issue was reported on #24941 (comment). It was initially discovered in loopbackio/loopback-next#1643. In this case, MetadataAccessor is exported from @loopback/metadata and re-exported by @loop...
X Description: The issue was reported on #24941 (comment). It was initially discovered in loopbackio/loopback-next#1643. In this case, MetadataAccessor is exported from @loopback/metadata and re-exported by @loop...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/26985
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TypeScript generates invalid `import` for re-exported types","articleBody":"The issue was reported on https://github.com/Microsoft/TypeScript/pull/24941#issuecomment-415900977. It was initially discovered in strongloop/loopback-next#1643.\r\n\r\nIn this case, MetadataAccessor is exported from @loopback/metadata and re-exported by @loopback/context. Please note that @loopback/repository-json-schema module imports MetadataAccessor from @loopback/context. It leads to incorrectly generated code.\r\n\r\n\u003c!-- Please try to reproduce the issue with `typescript@next`. It may have already been fixed. -->\r\n**TypeScript Version:** 3.0.x and up\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:** TypeScript import types\r\n\r\n**Code**\r\n\r\nhttps://github.com/strongloop/loopback-next/blob/5b27323ba420bfc500fdf9f2762e7292b96ffa0f/packages/repository-json-schema/src/keys.ts\r\n\r\n```ts\r\n// A *self-contained* demonstration of the problem follows...\r\n// Test this by running `tsc` on the command-line, rather than through another build tool such as Gulp, Webpack, etc.\r\n```\r\n\r\n**Expected behavior:**\r\n\r\nTypeScript generates the following code:\r\n```ts\r\nimport { MetadataAccessor } from '@loopback/context';\r\nimport { JSONSchema6 as JSONSchema } from 'json-schema';\r\n/**\r\n * Metadata key used to set or retrieve repository JSON Schema\r\n */\r\nexport declare const JSON_SCHEMA_KEY: MetadataAccessor\u003cJSONSchema, import(\"@loopback/context\").DecoratorType>;\r\n```\r\n**Actual behavior:**\r\n\r\nTypeScript generates invalid code as follows:\r\n```ts\r\nimport { MetadataAccessor } from '@loopback/context';\r\nimport { JSONSchema6 as JSONSchema } from 'json-schema';\r\n/**\r\n * Metadata key used to set or retrieve repository JSON Schema\r\n */\r\nexport declare const JSON_SCHEMA_KEY: MetadataAccessor\u003cJSONSchema, import(\"../context/node_modules/@loopback/metadata/src/types\").DecoratorType>;\r\n```\r\n**Playground Link:** \u003c!-- A link to a TypeScript Playground \"Share\" link which demonstrates this behavior -->\r\n\r\n**Related Issues:** \u003c!-- Did you find other bugs that looked similar? -->\r\nhttps://github.com/Microsoft/TypeScript/pull/24874\r\n","author":{"url":"https://github.com/raymondfeng","@type":"Person","name":"raymondfeng"},"datePublished":"2018-09-09T04:08:32Z","url":"https://github.com/microsoft/TypeScript/issues/26985"}
| 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:1c605b99-91bc-bf15-2e9d-38d43b3fab3b |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | BA36:1FE434:E752A4:1317832:6B01D261 |
| html-safe-nonce | ecfbb1136fe05d5c5c779e31c010e174068ea372011e26bc1cdd64046eb9364f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCQTM2OjFGRTQzNDpFNzUyQTQ6MTMxNzgzMjo2QjAxRDI2MSIsInZpc2l0b3JfaWQiOiI3NjcwMDMyNzY0NTU2NjYxMzQ2IiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 4d8e53dbfb52ba8782525cea5089495ba9e1bbf478267b609615d6b64f39bacd |
| hovercard-subject-tag | issue:358347937 |
| 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/26985/issue_layout |
| twitter:image | https://opengraph.githubassets.com/32a601f98156fb0b8621ecfcc842956acce2e544f2ce206d0a53aaa2a7490f5d/microsoft/TypeScript/issues/26985 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/32a601f98156fb0b8621ecfcc842956acce2e544f2ce206d0a53aaa2a7490f5d/microsoft/TypeScript/issues/26985 |
| og:image:alt | The issue was reported on #24941 (comment). It was initially discovered in loopbackio/loopback-next#1643. In this case, MetadataAccessor is exported from @loopback/metadata and re-exported by @loop... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | raymondfeng |
| 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