Title: Type definitions not exported correctly for vscode (intellisense not working on clean projects) · Issue #16879 · angular/angular-cli · GitHub
Open Graph Title: Type definitions not exported correctly for vscode (intellisense not working on clean projects) · Issue #16879 · angular/angular-cli
X Title: Type definitions not exported correctly for vscode (intellisense not working on clean projects) · Issue #16879 · angular/angular-cli
Description: I tried searching everywhere for this issue but actually very few people noticed it (to my surprise). The only thing I could find is this stackoverlow question 🐞 bug report Affected Package The issue is caused by package @angular/.... Is...
Open Graph Description: I tried searching everywhere for this issue but actually very few people noticed it (to my surprise). The only thing I could find is this stackoverlow question 🐞 bug report Affected Package The iss...
X Description: I tried searching everywhere for this issue but actually very few people noticed it (to my surprise). The only thing I could find is this stackoverlow question 🐞 bug report Affected Package The iss...
Opengraph URL: https://github.com/angular/angular-cli/issues/16879
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Type definitions not exported correctly for vscode (intellisense not working on clean projects)","articleBody":"I tried searching everywhere for this issue but actually very few people noticed it (to my surprise).\r\nThe only thing I could find is this [stackoverlow question](https://stackoverflow.com/questions/55082763/vscode-intellisense-doesnt-suggest-angular-modules-until-imported-manually-in-t)\r\n\r\n# 🐞 bug report\r\n\r\n### Affected Package\r\n\u003c!-- Can you pin-point one or more @angular/* packages as the source of the bug? -->\r\n\u003c!-- ✍️edit: --> The issue is caused by package @angular/....\r\n\r\n\r\n### Is this a regression?\r\n\r\nI don't think so, as far as I can recall IntelliSense on vscode never worked but it's a very subtle issue (for this reason I'm not sure when this started or if it has always been like this). \r\nIn fact, just a few people noticed this behavior because vscode seems to be smart enough to remember and understand after the first manual import\r\n\r\n### Description\r\n\r\nVscode has two ways to provide hints through IntelliSense to the developer (you can read it [here](https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html)):\r\n\r\nIt can either look for the node_modules/@types folder or get the type definition file in the package.json, under the \"typings\" or \"types\" key (the first way is more suited for non ts libraries/frameworks).\r\n\r\nYou enforce the first one through your cli when calling `ng new my-app` in tsconfig.json we find:\r\n\r\n```\r\n\"typeRoots\": [\r\n \"node_modules/@types\"\r\n],\r\n```\r\n\r\nbut in all the new angular projects generated by the cli, the @types folder is missing the angular types:\r\n\r\n\r\n\r\nRelating this behavior to how React handles this, for example, isn't ok. With React we correctly get suggestions and the type definitions file appear correctly in the @types folder:\r\n\r\n\r\n\r\nSo, knowing that maybe pointing typeRoots to the node_modules/@angular folder would solve the problem, **an attempt I've done** is to include it there.\r\n**Problem solved partially**, why? Because then all the routing stuff **were** importable, but **still not** the http stuff.\r\n\r\nHow come?\r\nBecause vscode is looking at your package.json files available in the node_modules/@angular folder, with the `router`, everything's ok:\r\n\r\n\r\n\r\nbut not with the `common` package.json:\r\n\r\n\r\n\r\nsince the common.d.ts file has no reference for many stuff like, for example, the httpclient module:\r\n\r\n\r\n\r\n## 🔬 Minimal Reproduction\r\nSee yourself, open stackblitz with a blank project: https://stackblitz.com/fork/angular\r\nand write HttpC (press ctrl+space too that is usually the command to make the hints show up) and see that no correct suggestion is shown.\r\n\r\n\r\n\r\n\r\n**Anything else relevant?**\r\n\r\nI will put up a PR exporting all the needed definitions directly from the common.d.ts file and please, edit your cli to generate the tsconfig.json including node_modules/@angular\r\n\r\n## 🌍 Your Environment\r\n\r\n**Angular Version:**\r\n```\r\nAngular CLI: 9.0.1\r\nNode: 12.13.1\r\nOS: win32 x64\r\n\r\nAngular: 9.0.0\r\n... animations, common, compiler, compiler-cli, core, forms\r\n... language-service, platform-browser, platform-browser-dynamic\r\n... router\r\nIvy Workspace: Yes\r\n\r\nPackage Version\r\n-----------------------------------------------------------\r\n@angular-devkit/architect 0.900.1\r\n@angular-devkit/build-angular 0.900.1\r\n@angular-devkit/build-optimizer 0.900.1\r\n@angular-devkit/build-webpack 0.900.1\r\n@angular-devkit/core 9.0.1\r\n@angular-devkit/schematics 9.0.1\r\n@angular/cli 9.0.1\r\n@ngtools/webpack 9.0.1\r\n@schematics/angular 9.0.1\r\n@schematics/update 0.900.1\r\nrxjs 6.5.4\r\ntypescript 3.7.5\r\nwebpack 4.41.2\r\n```","author":{"url":"https://github.com/giacomocerquone","@type":"Person","name":"giacomocerquone"},"datePublished":"2020-02-07T17:00:13Z","url":"https://github.com/angular/angular-cli/issues/16879"}
| 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:3419b9de-5bcb-f26f-f807-59d6b4e526bd |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8064:31B4CC:977FE1:C951C1:6B00E269 |
| html-safe-nonce | 741235d25699d9f224f1f1a24509377fbcac1c833e590f55f5199a00d9ebc25c |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4MDY0OjMxQjRDQzo5NzdGRTE6Qzk1MUMxOjZCMDBFMjY5IiwidmlzaXRvcl9pZCI6IjcyMjE5MTc4NDk5NDQ2NDYyNDkiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 166ab3feb8820b4d6ca11e246c977ae40a0fd9728fd5e82b28ced06140c29875 |
| hovercard-subject-tag | issue:561814548 |
| 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/angular/angular-cli/16879/issue_layout |
| twitter:image | https://opengraph.githubassets.com/6285acb42c7275cf7e41e345012c9f3af449a23173ced9aa001050ba41129d86/angular/angular-cli/issues/16879 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/6285acb42c7275cf7e41e345012c9f3af449a23173ced9aa001050ba41129d86/angular/angular-cli/issues/16879 |
| og:image:alt | I tried searching everywhere for this issue but actually very few people noticed it (to my surprise). The only thing I could find is this stackoverlow question 🐞 bug report Affected Package The iss... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | giacomocerquone |
| hostname | github.com |
| expected-hostname | github.com |
| None | 27088b6977484d0d3321d9a11c907c6d6637b315cfa359ef7952dbf6292f9b14 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| 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 | 624179fb8b88d26ba5bba08894eb60a1c5a1d93d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width