Search code examples
angulartypescriptwebstorm

WebStorm: Angular template type checking


Is there a way in WebStorm to allow TypeScript type checking for Angular component bindings and other expressions?

I just think it would be great if I could set @Input() properties types in component.ts files and editor would warn me if a particular binding type is wrong in a particular template.


Solution

  • There is an angular compiler option introduced in version 9 that does the most amount of template checking: strictTemplates.

    You can find the docs on template checking here: https://angular.io/guide/template-typecheck

    Alternatives

    Angular template checking is performed by the angular compiler. If you want type safe templates powered by just TypeScript, give JSX a go (with something like React http://youtube.com/watch?v=-oEa6UueHsk).