Type safety in templates

Hello! New to aurelia and working in a codebase that uses it. In the course of developing, I had a question about the feasibility of type safety.

Specifically, I was curious if it’s possible to have some form of type checking in templates? Supposing I have an element with a bindable property with the type:

// my-component.ts
export class MyComponent {
  @bindable kind: "foo" | "bar";

  ...
}

and a call site that uses an incorrect value:

// some-file.html
<template>
  <my-component kind="baz"></my-component>
</template>

Is it possible to get a warning from the compiler? This would make refactoring simpler and catch certain bugs without relying on automated or manual testing.

3 Likes

This is what I am also looking into also. Recently, it started to be very hard to keep track of changes in template side as our project grew in size.

It’s a thorny issue, and a resolution is being attempted, :crossed_fingers:

2 Likes