Guidelines

This page includes common guidelines shared among packages in the svelte-put collections.

Action as Element Directive

Any svelte action exported by a package should be used with element and not component.

<Component use:action /> <-- incorrect usage-->
<div use:action /> <-- correct usage-->

Should I use Typescript or not?

If you are developing Svelte application (typically with SvelteKit & Vite), there is no reason not to use Typescript for its convenience in development workflow. One completely valid alternative to Typescript is just plain Javascript with JSDoc, which, if setup correctly, will go to the same Typescript type checker and provide similar type checking benefits without the hassle of tooling setup. The packages in this collection are in fact written in Javascript with JSDoc.

Throughout the documentation, however, you will see example code in Typescript. This is frankly just me being lazy and not wanting to maintain two versions of every code block. Sorry!

Edit this page on Github