Closed Buslowicz closed 7 years ago
Hm, I don't think it's a good idea. This diverges too much from plain Polymer IMO and break the principle of least astonishment. TWC already greatly improves compute function and properties. Do you think it is not enough?
When working on the previous Polymer project, we had a big pain creating a method for every even the simplest expression. As in many cases it might be business logic, sometimes it is pure UI logic and should not pollute the class. Also it is optional, so nobody would be forced to use it ;). I was planning to only add that when using template()
method to provide a template. If using a template string inside, people would most likely try to use expressions with ${ ... }
and if expressions were not supported, it would break the native TypeScript feeling. For example:
template() {
return `<template is="dom-if" if="${this.type === "someType"}"> ... </template>`;
}
There are very many cases like that and it's just simpler to use this kind of expression than to use methods for that.
Make it possible to use JavaScript expressions in the templates, instead of simple properties binding. Expressions should be changed to either functions or computed properties.