Are there any TypeScript reactive frameworks? I know you can use TS with the others, but finding tutorials can be a pain since it all these are JS first frameworks.
Are there any TypeScript reactive frameworks? I know you can use TS with the others, but finding tutorials can be a pain since it all these are JS first frameworks.
I'm basically trying to do a superset of typescript where you create elements so:
const root = c({
el: 'div',
children: [
`hello, ${store.user.name}`
],
attr: {
class: 'bold smart',
id: 'abc',
bla: true,
},
evts: {
click: () => {
console.log("Clicked")
}
}
});
And store store.user.name is "magically" reactive.Was that what you meant?
Why do you think we have async/await now instead of manually typing out all the promise syntaxic mess every time?
For reference, in Svelte that’d be something like this, which is shorter and more obvious:
<div class="bold smart" id="abc" bla={true} on:click={() => { console.log("Clicked") }>
hello, {store.user.name}
</div>This is very early stages and completely experimental.
The idea I'm experimenting is to compile typescript to another form, I completely see your point about too verbose though, but I'm also toying around with jsx.
Basically what I'm trying to do is a svelte where instead of this:
{#each cats as { id, name }, i}
<li>
<a target="_blank" href="https://www.youtube.com/watch?v={id}">
{i + 1}: {name}
</a>
</li>
{/each}
You have have the native JavaScript map functions and so on.Again, this is completely in the early stages and just playing around until something feels right.
Any recommendations appreciated.
There are TypeScript plugins to statically analyze the templates, like lit-analyzer and the lit-plugin VS Code extension.
LitElement provides TypeScript decorators for declaring reactive properties and more.
TypeScript doesn't in general change its emit based on types, so its runtime feature set is exactly the same as JavaScript.
lit-html has a TypeScript compiler plug-in which provides template type=-checking, and LitElement provides decorators, like I said. How would something be more aimed at TypeScript, and not JavaScript?