Creating a typed version of Aurelia’s computedFrom decorator with Typescript
When using the computedFrom decorator in Aurelia, you currently need to specify the fields it depends upon using strings. Which is useful, because in Aurelia you could create a field/ property that is only defined in the view and not in the ViewModel.
Now if you are using TypeScript and are very used to things being typed, you might not like these strings, because they could contain typos.
In version 2.1 of TypeScript, the keyof index type query was introduced which allows us to force a string to equal one of the member names of an object. With this new feature, we can make the computedFrom decorated typed.