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. …

Erik Lieben

Erik is a full stack web developer at Effectory and member of the Aurelia Core team. Organizer of the Aurelia & dotnet Amsterdam meetup.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store