Title: Issue with `fullTemplateTypeCheck` and `ng serve` · Issue #15762 · angular/angular-cli · GitHub
Open Graph Title: Issue with `fullTemplateTypeCheck` and `ng serve` · Issue #15762 · angular/angular-cli
X Title: Issue with `fullTemplateTypeCheck` and `ng serve` · Issue #15762 · angular/angular-cli
Description: 🐞 Bug report Command (mark with an x) - [ ] new - [ ] build - [x] serve - [ ] test - [ ] e2e - [ ] generate - [ ] add - [ ] update - [ ] lint - [ ] xi18n - [ ] run - [ ] config - [ ] help - [ ] version - [ ] doc Is this a regression? I d...
Open Graph Description: 🐞 Bug report Command (mark with an x) - [ ] new - [ ] build - [x] serve - [ ] test - [ ] e2e - [ ] generate - [ ] add - [ ] update - [ ] lint - [ ] xi18n - [ ] run - [ ] config - [ ] help - [ ] ver...
X Description: 🐞 Bug report Command (mark with an x) - [ ] new - [ ] build - [x] serve - [ ] test - [ ] e2e - [ ] generate - [ ] add - [ ] update - [ ] lint - [ ] xi18n - [ ] run - [ ] config - [ ] help - [ ] ver...
Opengraph URL: https://github.com/angular/angular-cli/issues/15762
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Issue with `fullTemplateTypeCheck` and `ng serve`","articleBody":"# 🐞 Bug report\r\n\r\n### Command (mark with an `x`)\r\n```\r\n- [ ] new\r\n- [ ] build\r\n- [x] serve\r\n- [ ] test\r\n- [ ] e2e\r\n- [ ] generate\r\n- [ ] add\r\n- [ ] update\r\n- [ ] lint\r\n- [ ] xi18n\r\n- [ ] run\r\n- [ ] config\r\n- [ ] help\r\n- [ ] version\r\n- [ ] doc\r\n```\r\n\r\n\r\n### Is this a regression?\r\n\r\nI don't know.\r\n\r\n\r\n### Description\r\n\r\nWhen having `fullTemplateTypeCheck` enabled in `tsconfig.json` and running `ng serve` everything runs fine initially. I might, for example, get nice error messages about my template type-check issues (with colors and everything :smiley:):\r\n\r\n```\r\nERROR in src/app/app.component.html:38:66 - error TS2322: Type 'SearchResults | null' is not assignable to type 'SearchResults | undefined'.\r\n Type 'null' is not assignable to type 'SearchResults | undefined'.\r\n\r\n38 \u003caio-search-results #searchResultsView *ngIf=\"showSearchResults\" [searchResults]=\"searchResults | async\" (resultSelected)=\"hideSearchResults()\">\u003c/aio-search-results>\r\n ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\r\n\r\n src/app/app.component.ts:23:16\r\n 23 templateUrl: './app.component.html',\r\n ~~~~~~~~~~~~~~~~~~~~~~\r\n Error occurs in the template of component AppComponent.\r\n```\r\n\r\nThen on re-compiling (e.g. after editing a file and saving), I get the following error:\r\n\r\n```\r\nERROR in ./src/main.ts\r\n at plugin.done.then ([...]\\angular\\aio\\node_modules\\@ngtools\\webpack\\src\\loader.js:41:31)\r\n at process._tickCallback (internal/process/next_tick.js:68:7)\r\nERROR in ./src/polyfills.ts\r\nModule build failed (from ./node_modules/@ngtools/webpack/src/index.js):\r\nError: [...]\\angular\\aio\\src\\polyfills.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.\r\n at AngularCompilerPlugin.getCompiledFile ([...]\\angular\\aio\\node_modules\\@ngtools\\webpack\\src\\angular_compiler_plugin.js:918:23)\r\n at plugin.done.then ([...]\\angular\\aio\\node_modules\\@ngtools\\webpack\\src\\loader.js:41:31)\r\n at process._tickCallback (internal/process/next_tick.js:68:7)\r\ni 「wdm」: Failed to compile.\r\n```\r\n\r\nI might then get some error template type-check errors, but not as nicely formatted (or colorful) as before:\r\n\r\n```\r\nERROR in src/app/app.component.html(38,66): error TS2322: Type 'SearchResults | null' is not assignable to type 'SearchResults | undefined'.\r\n Type 'null' is not assignable to type 'SearchResults | undefined'.\r\n src/app/app.component.html(47,63): error TS2322: Type 'NavigationNode[]' is not assignable to type 'Option[]'.\r\n Type 'NavigationNode' is not assignable to type 'Option'.\r\n Types of property 'title' are incompatible.\r\n Type 'string | undefined' is not assignable to type 'string'.\r\n Type 'undefined' is not assignable to type 'string'.\r\n src/app/app.component.html(47,87): error TS2322: Type 'NavigationNode' is not assignable to type 'Option'.\r\n src/app/custom-elements/api/api-list.component.html(24,8): error TS2322: Type 'ApiSection[] | null' is not assignable to type 'ApiSection[] | Iterable\u003cApiSection> | undefined'.\r\n...\r\n```\r\n\r\nAfter this first error, the app is not re-compiled when I make changes (I have to stop the process and run `ng serve` anew).\r\n\r\n(NOTE: The error seems only (or much more often) happen when there _are_ template type-check errors.)\r\n\r\n\r\n## 🔬 Minimal Reproduction\r\n\r\nIt started happening for me in PR angular/angular#32980. To reproduce, you could:\r\n\r\n1. Check out the PR.\r\n2. Reset to the commit before ``build(docs-infra): enable `fullTemplateTypeCheck` (and fix failures)`` (currently https://github.com/angular/angular/pull/32980/commits/3f228a626).\r\n3. Add `fullTemplateTypeCheck: true` in `aio/tsconfig.json > angularCompilerOptions`.\r\n4. Run `yarn --cwd=aio && yarn --cwd=aio start`. _(You should see some nice template type-check error messages.)_\r\n5. Open `aio/src/app/app.component.ts`, make a change and save it. _(You should see the error.)_\r\n\r\n(NOTE: If that reproduction isn't helpful, I can try to create a minimal one with a new app.)\r\n\r\n\r\n## 🌍 Your Environment\r\n\r\n(NOTE: I am on 9.0.0-next.8 now, but this happened with 9.0.0-next.6 as well.)\r\n\r\n\u003cpre>\u003ccode>\r\nAngular CLI: 9.0.0-next.8\r\nNode: 10.16.3\r\nOS: win32 x64\r\nAngular: 9.0.0-next.9\r\n... animations, common, compiler, compiler-cli, core, elements\r\n... forms, language-service, platform-browser\r\n... platform-browser-dynamic, router, service-worker\r\n\r\nPackage Version\r\n-----------------------------------------------------------\r\n@angular-devkit/architect 0.900.0-next.8\r\n@angular-devkit/build-angular 0.900.0-next.8\r\n@angular-devkit/build-optimizer 0.900.0-next.8\r\n@angular-devkit/build-webpack 0.900.0-next.8\r\n@angular-devkit/core 9.0.0-next.8\r\n@angular-devkit/schematics 9.0.0-next.8\r\n@angular/cdk 9.0.0-next.0\r\n@angular/cli 9.0.0-next.8\r\n@angular/material 9.0.0-next.0\r\n@ngtools/webpack 9.0.0-next.8\r\n@schematics/angular 9.0.0-next.8\r\n@schematics/update 0.900.0-next.8\r\nrxjs 6.5.3\r\ntypescript 3.5.3\r\nwebpack 4.41.0\r\n\u003c/code>\u003c/pre>\r\n","author":{"url":"https://github.com/gkalpak","@type":"Person","name":"gkalpak"},"datePublished":"2019-10-04T12:30:20Z","url":"https://github.com/angular/angular-cli/issues/15762"}
| 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:be03ddd2-3088-5711-7e15-4a5979122c07 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | D22E:22DB35:2774F4F:3259D7E:6B0188D5 |
| html-safe-nonce | c0adca194ef0f3c16a04d253dec7f536ce9c138fdf1615e2e08cd47ed6f88ff5 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJEMjJFOjIyREIzNToyNzc0RjRGOjMyNTlEN0U6NkIwMTg4RDUiLCJ2aXNpdG9yX2lkIjoiMzU2MTY2NDYwNDgxMzc1NjYyOSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 5dfe53c7fcfd322a462720f30af7e19c38b973f2c996368e8ab0a75639e7b4e1 |
| hovercard-subject-tag | issue:502609333 |
| 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/15762/issue_layout |
| twitter:image | https://opengraph.githubassets.com/63740197222b2b77b6b73599d3f54beb5cae9b0848fdec61e965ca14d99af5a1/angular/angular-cli/issues/15762 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/63740197222b2b77b6b73599d3f54beb5cae9b0848fdec61e965ca14d99af5a1/angular/angular-cli/issues/15762 |
| og:image:alt | 🐞 Bug report Command (mark with an x) - [ ] new - [ ] build - [x] serve - [ ] test - [ ] e2e - [ ] generate - [ ] add - [ ] update - [ ] lint - [ ] xi18n - [ ] run - [ ] config - [ ] help - [ ] ver... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | gkalpak |
| hostname | github.com |
| expected-hostname | github.com |
| None | cc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c |
| 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 | 8c77c9e8439031ad54c75a250694842892f693e1 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width