4 ms·
Angular team member here. Strict type checking is often reported as confusing for folks getting started with Angular and web development. That's why by default
by mgechev 6y ago
Angular team member here.
Strict type checking is often reported as confusing for folks getting started with Angular and web development. That's why by default our type checking is not the strictest we support.
To make sure advanced developers have better compile-time type checking and editor support, we introduced strict mode. When you create a new workspace the CLI asks you if you want to get it enabled.
In the future, incrementally, we'll be enabling strict settings for everyone.
- davedx 6y agoThanks for commenting! It still seems strange to me, if you start a new Angular project then you know you're writing TypeScript, no ifs or buts - and that means if you write some code that doesn't compile, you'll have to fix it before it runs. I don't understand why that's seen as different in the template layer? Great that it's there at all though, last time I developed with Angular templates didn't have type checking at all, and it kind of hurt.
- mgechev 6y agoSorry for the miscommunication. I meant type checking in general, not in Angular templates in particular. To get the same strictness as in TypeScript, you can enable `strictTemplates` in tsconfig.json. Here's our guide which goes into more details https://angular.io/guide/template-typecheck https://angular.io/guide/template-typecheck.