Assuming an Angular 1.6 app using best practices (components/bind-to-controller where possible), can we harness the power of TypeScript in templates?
For example if we have some template code
<div>{{$ctrl.children[0].name}}</div>
& we know the type of the controller ($ctrl) - can we have TypeScript give us an error if
- 'children' does not exist on $ctrl
- 'children' is not an array
- the items in 'children' do not have a property 'name' (etc)?
Code completion in VS Code would be nice too.
I've seen the issues below:
- https://github.com/Microsoft/TypeScript/issues/6508
- https://github.com/Microsoft/TypeScript/issues/5151
However it's difficult to conclude from that where things are at (especially in the AngularJS 1.x world).