template type-checking in Ivy throws error for slice pipe
See original GitHub issue🐞 bug report
Affected Package
The issue is caused by package @angular/compiler-cli
Is this a regression?
it appeared with ng 8.0.0-beta.14
Description
A component with an ngFor
and a slice
like:
<div *ngFor="let user of users | slice:0:1">{{ user.name }}</div>
with users
declared as
interface UserModel {
name: string;
};
//...
users: Array<UserModel> = [{ name: 'jane' }];
throws an error in Ivy when compiling with template type-check.
🔬 Minimal Reproduction
ng new ivy-slice --defaults --enable-ivy
Edit tsconfig.app.json
to add:
"angularCompilerOptions": {
"enableIvy": true,
"fullTemplateTypeCheck": true
}
Update app.component.html
and app.component.ts
as above, and run ng build --aot
🔥 Exception or Error
ERROR in __ng_typecheck__.ts(14,13): error TS2339: Property 'name' does not exist on type '{}'.
🌍 Your Environment
Angular Version:
Angular CLI: 8.0.0-beta.18
Node: 11.11.0
OS: darwin x64
Angular: 8.0.0-beta.14
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.800.0-beta.18
@angular-devkit/build-angular 0.800.0-beta.18
@angular-devkit/build-optimizer 0.800.0-beta.18
@angular-devkit/build-webpack 0.800.0-beta.18
@angular-devkit/core 8.0.0-beta.18
@angular-devkit/schematics 8.0.0-beta.18
@angular/cli 8.0.0-beta.18
@ngtools/webpack 8.0.0-beta.18
@schematics/angular 8.0.0-beta.18
@schematics/update 0.800.0-beta.18
rxjs 6.4.0
typescript 3.4.5
webpack 4.30.0
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Angular 9's Best Hidden Feature: Strict Template Checking
Find and report more errors than ever with Angular 9's Ivy compiler, strict template checking.
Read more >Angular Ivy Typer-Checking | Alex Rickabaugh - MeetupFeed
Angular Ivy features strictTemplates, a compiler flag that turns on much stronger validation and type-checking of component templates.
Read more >Template type checking - Angular
Overview of template type checkinglink ... Just as TypeScript catches type errors in your code, Angular checks the expressions and bindings within the...
Read more >Type-checking templates in Angular View Engine and Ivy
In this article we'll explore how Angular type-checks templates, review the difference between View Engine and Ivy type-checking and break down the process ......
Read more >Angular 11 is out! A quick trip to new things in it | by FAM
Ivy new Features ... A comprehensive type-checking within templates. ... Slice pipe now returns null for the undefined input value.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m having this same issue. Has anyone been able to find a workaround and/or is this issue being addressed by the Angular team?
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.