Title: TypeScript 2.9.2 is generating long relative paths for packages starting with @ · Issue #24980 · microsoft/TypeScript · GitHub
Open Graph Title: TypeScript 2.9.2 is generating long relative paths for packages starting with @ · Issue #24980 · microsoft/TypeScript
X Title: TypeScript 2.9.2 is generating long relative paths for packages starting with @ · Issue #24980 · microsoft/TypeScript
Description: TypeScript Version: 2.9.2 Search Terms: Relative Path Packages starting with @ Code The following code defines a React component called MiniRadio. It is using several imports from Material-UI. The package name for Material-UI starts with...
Open Graph Description: TypeScript Version: 2.9.2 Search Terms: Relative Path Packages starting with @ Code The following code defines a React component called MiniRadio. It is using several imports from Material-UI. The ...
X Description: TypeScript Version: 2.9.2 Search Terms: Relative Path Packages starting with @ Code The following code defines a React component called MiniRadio. It is using several imports from Material-UI. The ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/24980
X: @github
Domain: github.com
IPv4 address: 140.82.114.3
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"TypeScript 2.9.2 is generating long relative paths for packages starting with @","articleBody":"**TypeScript Version:** 2.9.2\r\n\r\n\u003c!-- Search terms you tried before logging this (so others can find this issue more easily) -->\r\n**Search Terms:** \r\nRelative Path\r\nPackages starting with `@`\r\n\r\n**Code**\r\nThe following code defines a React component called `MiniRadio`. It is using several imports from Material-UI. The package name for Material-UI starts with the `@` character:\r\n\r\n```ts\r\nimport * as React from 'react';\r\n\r\nimport Radio from '@material-ui/core/Radio';\r\nimport {\r\n createStyles,\r\n StyledComponentProps,\r\n WithStyles,\r\n withStyles\r\n} from '@material-ui/core/styles';\r\n\r\nexport const styles = createStyles({\r\n radio: {\r\n width: 24,\r\n height: 24\r\n }\r\n});\r\n\r\nexport interface MiniRadioProps extends WithStyles\u003ctypeof styles> {\r\n className: string;\r\n checked: boolean;\r\n value: string | undefined;\r\n color?: 'primary' | 'secondary' | 'default';\r\n label?: string;\r\n onChange?: React.EventHandler\u003cany>;\r\n}\r\n\r\nexport const MiniRadio = withStyles(styles)(\r\n class extends React.Component\u003cMiniRadioProps> {\r\n render() {\r\n const { classes, ...rest } = this.props;\r\n\r\n return (\r\n \u003cRadio\r\n className={classes.radio}\r\n {...rest}\r\n />\r\n );\r\n }\r\n }\r\n);\r\n```\r\n\r\n**Expected behavior:**\r\nWith TypeScript version 2.8.3, the above code generates the following type definition, Notice the clean declaration for `MiniRadio` in the last line.\r\n\r\n```\r\n/// \u003creference types=\"react\" />\r\nimport * as React from 'react';\r\nimport { StyledComponentProps, WithStyles } from '@material-ui/core/styles';\r\nexport declare const styles: {\r\n radio: {\r\n width: number;\r\n height: number;\r\n };\r\n};\r\nexport interface MiniRadioProps extends WithStyles\u003ctypeof styles> {\r\n className: string;\r\n checked: boolean;\r\n value: string | undefined;\r\n color?: 'primary' | 'secondary' | 'default';\r\n label?: string;\r\n onChange?: React.EventHandler\u003cany>;\r\n}\r\nexport declare const MiniRadio: React.ComponentType\u003cPick\u003cMiniRadioProps, \"label\" | \"color\" | \"className\" | \"onChange\" | \"theme\" | \"value\" | \"checked\"> & StyledComponentProps\u003c\"radio\">>;\r\n```\r\n\r\n**Actual behavior:**\r\nWith TypeScript version 2.9.2, the exact same code generates the following type definition. Notice the long relative pathname for `@material-ui/core` in the last line:\r\n\r\n```\r\nimport * as React from 'react';\r\nimport { StyledComponentProps, WithStyles } from '@material-ui/core/styles';\r\nexport declare const styles: {\r\n radio: {\r\n width: number;\r\n height: number;\r\n };\r\n};\r\nexport interface MiniRadioProps extends WithStyles\u003ctypeof styles> {\r\n className: string;\r\n checked: boolean;\r\n value: string | undefined;\r\n color?: 'primary' | 'secondary' | 'default';\r\n label?: string;\r\n onChange?: React.EventHandler\u003cany>;\r\n}\r\nexport declare const MiniRadio: React.ComponentType\u003cimport(\"../../../../../../../../../Users/narbhati/projects/trader-desktop-solution/node_modules/@material-ui/core\").Overwrite\u003cMiniRadioProps, StyledComponentProps\u003c\"radio\">>>;\r\n```\r\n\r\n**tsconfig.json:**\r\n\r\n```\r\n{\r\n \"compilerOptions\": {\r\n \"declaration\": true,\r\n \"declarationDir\": \"dist/types\",\r\n \"experimentalDecorators\": true,\r\n \"jsx\": \"react\",\r\n \"lib\": [\"es2015\", \"es2016\", \"es2017\", \"dom\"],\r\n \"module\":\"commonjs\",\r\n \"outDir\": \"./dist\",\r\n \"sourceMap\": true,\r\n \"strict\": true,\r\n \"target\": \"es5\"\r\n },\r\n \"include\": [\r\n \"src\"\r\n ],\r\n \"exclude\": [\r\n \"src/**/*.story.ts*\",\r\n \"src/**/*.test.ts*\"\r\n ]\r\n}\r\n```","author":{"url":"https://github.com/nareshbhatia","@type":"Person","name":"nareshbhatia"},"datePublished":"2018-06-15T04:35:57Z","url":"https://github.com/microsoft/TypeScript/issues/24980"}
| 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:8a683482-b2f3-4dab-bc44-025e316aa2f0 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B724:5B106:25DF95:32E354:6B051406 |
| html-safe-nonce | baaf9c3fde99558809ec6cd52ca4b68a0283415be30c4158f0a126caefb23de4 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCNzI0OjVCMTA2OjI1REY5NTozMkUzNTQ6NkIwNTE0MDYiLCJ2aXNpdG9yX2lkIjoiNzc0MjY4MzQzMzQ0ODgzODE1MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 8632b6f9f80504d3c5d0779a9e0dedcde090cf8e06dd3ba06c28304c1e5b1afc |
| hovercard-subject-tag | issue:332643662 |
| 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/24980/issue_layout |
| twitter:image | https://opengraph.githubassets.com/347058a91879eb39838e5484cd31cd9db2dc675840039cf53a99a0740f7536e0/microsoft/TypeScript/issues/24980 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/347058a91879eb39838e5484cd31cd9db2dc675840039cf53a99a0740f7536e0/microsoft/TypeScript/issues/24980 |
| og:image:alt | TypeScript Version: 2.9.2 Search Terms: Relative Path Packages starting with @ Code The following code defines a React component called MiniRadio. It is using several imports from Material-UI. The ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | nareshbhatia |
| hostname | github.com |
| expected-hostname | github.com |
| None | 854d880890b5e847b3fce9d1b31f032107baeddeebad2aa379c48aa4f1451f6b |
| 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 | 220e980097d94ce616d5d11fbd5316d208e3fc93 |
| 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