Title: Allow configuration of NodeBuilderFlags.AllowNodeModulesRelativePaths for un-distributed mono repos · Issue #37960 · microsoft/TypeScript · GitHub
Open Graph Title: Allow configuration of NodeBuilderFlags.AllowNodeModulesRelativePaths for un-distributed mono repos · Issue #37960 · microsoft/TypeScript
X Title: Allow configuration of NodeBuilderFlags.AllowNodeModulesRelativePaths for un-distributed mono repos · Issue #37960 · microsoft/TypeScript
Description: Search Terms AllowNodeModulesRelativePaths The inferred type of ... cannot be named without a reference to ... #29808 #30858 #27340 Suggestion Allow the optional use of AllowNodeModulesRelativePaths during declaration creation Use Cases ...
Open Graph Description: Search Terms AllowNodeModulesRelativePaths The inferred type of ... cannot be named without a reference to ... #29808 #30858 #27340 Suggestion Allow the optional use of AllowNodeModulesRelativePath...
X Description: Search Terms AllowNodeModulesRelativePaths The inferred type of ... cannot be named without a reference to ... #29808 #30858 #27340 Suggestion Allow the optional use of AllowNodeModulesRelativePath...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/37960
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Allow configuration of NodeBuilderFlags.AllowNodeModulesRelativePaths for un-distributed mono repos","articleBody":"\r\n## Search Terms\r\n\r\n- AllowNodeModulesRelativePaths\r\n- The inferred type of ... cannot be named without a reference to ...\r\n- #29808 \r\n- https://github.com/microsoft/TypeScript/issues/30858\r\n- https://github.com/microsoft/TypeScript/pull/27340\r\n\r\n## Suggestion\r\n\r\nAllow the optional use of `AllowNodeModulesRelativePaths` during declaration creation \r\n\r\n## Use Cases\r\n\r\nI understand why @weswigham added https://github.com/microsoft/TypeScript/pull/27340 and it is correct for most consumers, especially those that publish packages for consumption on NPM. \r\n\r\nHowever, it seems like for npm style mono-repos where packages are only consumed locally and not published to a registry, it is valid to have seemingly non-portable TS references (lerna, pnpm, rush, yarn workspaces). A relative path to a node_module may still be valid as long as the structure stays consistent, which it does for this style of mono repo with a single node_modules directory. \r\n\r\nI am using a mono repo managed by Bazel and rules_nodejs and users are experiencing issues with the creation of declaration files that otherwise would contain relative paths to node_module files. https://github.com/bazelbuild/rules_nodejs/issues/1013\r\n\r\n(The conversation in https://github.com/microsoft/TypeScript/issues/30858 was helpful, however, it seemed to still be focusing on resolving portable types, which is only necessary when distributing the declaration files. If they are consumed locally, portability is not a concern. \r\n\r\n## Examples\r\n\r\nI'm not sure the best way (or standard way) for these flags to be set, however, I imagine an entry in the TSConfig Compiler Options would make the most sense: \r\n\r\n```diff\r\ninterface CompilerOptions {\r\n ...\r\n+ allowUnportableDeclarationImports: true\r\n} \r\n```\r\n\r\nCurrently I am patching Typescript to toggle on this behavior and it appears it is working just as expected.\r\n\r\n[typescript+3.7.3.patch.txt](https://github.com/microsoft/TypeScript/files/4476155/typescript%2B3.7.3.patch.txt)\r\n\r\n## Checklist\r\n\r\nMy suggestion meets these guidelines:\r\n\r\n* [X] This wouldn't be a breaking change in existing TypeScript/JavaScript code\r\n* [X] This wouldn't change the runtime behavior of existing JavaScript code\r\n* [X] This could be implemented without emitting different JS based on the types of the expressions\r\n* [X] This isn't a runtime feature (e.g. library functionality, non-ECMAScript syntax with JavaScript output, etc.)\r\n* [X] This feature would agree with the rest of [TypeScript's Design Goals](https://github.com/Microsoft/TypeScript/wiki/TypeScript-Design-Goals).\r\n","author":{"url":"https://github.com/joeljeske","@type":"Person","name":"joeljeske"},"datePublished":"2020-04-14T15:34:07Z","url":"https://github.com/microsoft/TypeScript/issues/37960"}
| 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:8b3cdcd9-0f4e-1f3b-3715-5c1557ed9d27 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8DCA:1EC9BC:33BD79E:4203929:6B01E388 |
| html-safe-nonce | f4181d84b75fd1e851dafa03a0a90d07e35fbc63f3bb41267d198ae5de5e179c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RENBOjFFQzlCQzozM0JENzlFOjQyMDM5Mjk6NkIwMUUzODgiLCJ2aXNpdG9yX2lkIjoiMTY4ODU4MDIwMjUzNzU0MjUzNiIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 4f025457c0f0b1692cad238d3bb2c36049f5ac36db18adb3efc585cf4f37d833 |
| hovercard-subject-tag | issue:599664401 |
| 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/37960/issue_layout |
| twitter:image | https://opengraph.githubassets.com/eb24a9032589d10451e1a9aa6de0841868b90f7de04bffff2b1661645b899f2c/microsoft/TypeScript/issues/37960 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/eb24a9032589d10451e1a9aa6de0841868b90f7de04bffff2b1661645b899f2c/microsoft/TypeScript/issues/37960 |
| og:image:alt | Search Terms AllowNodeModulesRelativePaths The inferred type of ... cannot be named without a reference to ... #29808 #30858 #27340 Suggestion Allow the optional use of AllowNodeModulesRelativePath... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | joeljeske |
| 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