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.

1 Like