I'm wondering how good Typescript support is. Can I use Typescript in the component script?
Sort of, via preprocessing, but you won't get any real benefit from it at present. There are two barriers: the compiler itself needs to become TS-aware, and we need to teach editors like VSCode how to typecheck inside blocks. It's very much on the radar (I'm a TS convert, personally — Svelte itself is written in TypeScript), we just need to get round to it. The version 3 rewrite was largely about laying the foundatio…
Svelte 3: Rethinking Reactivity
91–100 of 186 posts
Re: Svelte 3: Rethinking Reactivity
#92Thank you, contributors!
Re: Svelte 3: Rethinking Reactivity
#93Earlier quoted context omitted.
I think he means 'classical'as in class based. Just like you'd refer to 'classical' inheritance.
You might be right - I've never heard 'classical' used in that way, interesting!
Re: Svelte 3: Rethinking Reactivity
#94Very happy for this. I wrote a Firefox extension with Svelte v1, and will take this release of Svelte v3 as an opportunity to refactor my extension. Thank you, contributors!
Re: Svelte 3: Rethinking Reactivity
#95> Instead, Svelte runs at build time, converting your components into highly efficient imperative code that surgically updates the DOM. So, Svelte is compiled into web assembly? If not, given the emitted imperative code is less efficient than emitted web assembly and the emitted imperative code is less concise than the original declarative code, then what would be the advantage of an imperative translation of the dec…
Re: Svelte 3: Rethinking Reactivity
#96Earlier quoted context omitted.
Yep, and Svelte <3 Immer — they work nicely together.
Great work, just looking in to Svelte now after reviewing your latest release and video. First thing I looked for was routing, and I see Sapper is essentially batteries-included solution to using Svelte. Will these always be separate libraries? Is Sapper basically the create-svelte-app for your framework? What's the roadmap for Sapper and integrating Svelte v3 changes?
We've also mulled creating a React Router equivalent, for people who prefer components-as-routes to files-as-routes.
Re: Svelte 3: Rethinking Reactivity
#97Earlier quoted context omitted.
"Less code" implies less authored code, which may be a benefit of Svelte (is it? I haven't been able to use it much but it's on my radar) but doesn't necessarily map to its technical goals (less built code, less runtime processing). (Quick example: the countless hello world projects that result in >100KB bundles)
Authoring less code is definitely an explicit goal: https://svelte.dev/blog/write-less-code
Re: Svelte 3: Rethinking Reactivity
#98Re: Svelte 3: Rethinking Reactivity
#99Are web component going to happen with v3? I am trying to combine Python server app with Svelte enhanced HTML and got good results on v2. I noticed they are marked as todo: https://svelte.dev/docs#Custom_element_API
Re: Svelte 3: Rethinking Reactivity
#100Earlier quoted context omitted.
Funny: problems I think are important are "ship less code" and "read less code" (and perhaps "require reading less code to understand what's going on"). The writing part is not something I've considered to be especially problematic, thus far.
Allow me to try and convince you of its importance :) https://svelte.dev/blog/write-less-code
Edit: Some more clarification about why the arguments don't hold for me.
- More code = more bugs
I think code that is harder to understand leads to more bugs, but more characters typed does not necessarily directly result in more bugs, as far as I know.
- Writing code takes more time
Again, it's not the typing that takes time, but thinking of which code to write. If I have to type more, but there's less for me to keep in mind while typing (i.e. lower cognitive load), I'll be faster at that.
As said: yes, readability is important, but that's a different value than "write less code".
I'm trying not to make a judgment about Svelte here specifically since I haven't worked with it yet, and the general concept (of being a compiler rather than working during run-time) appeals to me. That said, concepts like bindings do scare me - with e.g. `useState` I know that the only places that can change `a` are those that call `setA`, whereas it appears that with Svelte, it can also change e.g. in response to `bind:value` attributes? I'm (perhaps misguidedly) afraid that that's saving a few characters at the cost of readability.