by dmitriid · 7y ago · 0 comments
onClick: "checkTodoItem()"
Why? What compells people to go ahead and say: yes, we’re writing everything in JS/TS which has perfectly fine support for actual functions. That’s why we’re going to arbitrarily use strings that evaluate to function calls in some parts of our framework.[1] See views https://typescene.dev/docs/introduction/overview
Anyway, yes Typescene does let you supply an actual function in place of the string here, but for me that ruins the 'neat' flow of the view and starts mixing views with logic.
onclick: () => function_to_be_defined_at_runtime()
This also lets you deal with functions that are defined at runtime. Moreover, this actually lets you provide types for the expected callbacks.> but for me that ruins the 'neat' flow of the view and starts mixing views with logic.
How is providing a reference to a function "logic"? You still provide a reference to a method, only you do it in an unspecified stringly-typed DSL.
Be sides, you're using these magical strings in so, so many places: https://news.ycombinator.com/item?id=20310666
This is anything but strongly typed. This is stringly typed.