Title: Auto-import not working for modules that are indirect dependencies · Issue #35023 · microsoft/TypeScript · GitHub
Open Graph Title: Auto-import not working for modules that are indirect dependencies · Issue #35023 · microsoft/TypeScript
X Title: Auto-import not working for modules that are indirect dependencies · Issue #35023 · microsoft/TypeScript
Description: TypeScript Version: 3.7.2 Issue I noticed that auto-import in VS Code stopped working for some of my projects after updating to TS 3.7 (everything worked in 3.6). After some digging I noticed that the Language Server logs included the li...
Open Graph Description: TypeScript Version: 3.7.2 Issue I noticed that auto-import in VS Code stopped working for some of my projects after updating to TS 3.7 (everything worked in 3.6). After some digging I noticed that ...
X Description: TypeScript Version: 3.7.2 Issue I noticed that auto-import in VS Code stopped working for some of my projects after updating to TS 3.7 (everything worked in 3.6). After some digging I noticed that ...
Opengraph URL: https://github.com/microsoft/TypeScript/issues/35023
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Auto-import not working for modules that are indirect dependencies","articleBody":"**TypeScript Version:** 3.7.2\r\n\r\n**Issue**\r\n\r\nI noticed that auto-import in VS Code stopped working for some of my projects after updating to TS 3.7 (everything worked in 3.6). After some digging I noticed that the Language Server logs included the line \"`forEachExternalModuleToImportFrom: filtered out XX modules by package.json contents`\".\r\n\r\n**In short, any module that isn't directly included in `package.json` seems to be _no longer_ considered for auto-import by TS 3.7.** This includes indirect dependencies: modules that are dependencies of modules that are in fact included in `package.json`.\r\n\r\nFor example, module 'my-web-lib' that has a dependency on 'my-lib' is in my package.json; but if I don't also include 'my-lib' in my package.json explicitly, the Language Server will no longer consider auto-importing from 'my-lib'. This used to work fine, which I found useful for 'meta' packages that import a bunch of versioned dependencies in one go, or perhaps a combined node/web package that's imported indirectly using web-specific or node-specific packages without having to mention (and version) the final packages.\r\n\r\nNow that I know what's going on, this seems like a trivial issue ('just add the indirect dependency to my package'). This is possibly a new _feature_ in TS 3.7, but I can't find it in the change logs. Just in case this is an unintended side effect of some other change, I'll create this issue here. Also in case others are confused as well, this issue might help them figure out what's going on.\r\n\r\n**Code**\r\nThis issue is related to NPM dependencies, so requires a bit of setup. Essentially, add a package.json dependency (or dev dependency) that itself has a dependency on a module that exports TypeScript types. Then try to import a symbol from the second-level dependency.\r\n\r\nI have a few specific examples but since I'm updating my repos to eradicate this issue, I won't leave any links here for now; please let me know if you need me to set up a repo.\r\n\r\n**Expected behavior:**\r\n\r\nAs above, auto-import like it used to work in 3.6.\r\n\r\n**Actual behavior:**\r\n\r\nAs above, indirect dependencies are no longer considered for auto-import.\r\n\r\n**Search Terms:** Auto-import indirect dependencies NPM modules d.ts","author":{"url":"https://github.com/jcormont","@type":"Person","name":"jcormont"},"datePublished":"2019-11-10T05:57:47Z","url":"https://github.com/microsoft/TypeScript/issues/35023"}
| 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:e355e33d-826a-7ce9-d03c-40efa3ea0ab1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | ED3E:882E2:D2533C:116D4D6:6B00F57B |
| html-safe-nonce | 43580d67049ba9e8df9add04c137afd6cfbd7faefaa182f98fa43f836b8f0c8e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFRDNFOjg4MkUyOkQyNTMzQzoxMTZENEQ2OjZCMDBGNTdCIiwidmlzaXRvcl9pZCI6IjI3NDMyOTA2MDEyNDcxNDMyOTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 807b0c24fdb22538e4ff995d94071353706d0e150b58e677471578166b169802 |
| hovercard-subject-tag | issue:520558737 |
| 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/35023/issue_layout |
| twitter:image | https://opengraph.githubassets.com/5ae262f649add920e00022cdfa99fdde7583a7818d9b79874cd3d4564f01dab1/microsoft/TypeScript/issues/35023 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/5ae262f649add920e00022cdfa99fdde7583a7818d9b79874cd3d4564f01dab1/microsoft/TypeScript/issues/35023 |
| og:image:alt | TypeScript Version: 3.7.2 Issue I noticed that auto-import in VS Code stopped working for some of my projects after updating to TS 3.7 (everything worked in 3.6). After some digging I noticed that ... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | jcormont |
| hostname | github.com |
| expected-hostname | github.com |
| None | 4ef498cbabcbe3c50befc7a5b743e7072ee770b4daf0e15e54801180d1fa91fc |
| 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 | 9983dd5da06943f833c971dd5b6bc988e2858be5 |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width