TypeScript
3 Followers 5 Questions

TypeScript is a statically typed superset of JavaScript that compiles to plain JavaScript. It adds type safety and modern features to improve code quality and maintainability. Popular in large-scale front-end and Node.js projects.

let or const for $derived runes in Svelte?

Variables in JavaScript can be defined using either let or const (ignoring the antiquated [var](...

0 votes 7 views 1 Answer Asked 28 days ago
How to type props in Svelte 5?

I understand that in Svelte 4 and previous versions props are individually declared using export let name: type = defaultValue;. For example in Svelte 4: I'm also aware of the new $props rune in Svelte 5, however I don't understand how I can type the props using th...

0 votes 7 views 1 Answer Asked about 1 month ago
s
69
How can I deal with localStorage in SvelteKit SSR?

I'm building a Notice component that users can dismiss, and I'm storing the displayed state of the notice, however, I would like to preserve it across sessions. localStorage seems like a good way to accomplish this, however, when trying to use localStorage I get s...

0 votes 11 views 1 Answer Asked about 2 months ago
How to loop an each block a specific x number of times in Svelte?

I know of Svelte's {#each} block which allows you to iterate over arrays or array-likes. However, there are some cases where I'm not interested in the data of an array, but rather in repeating a block a specific x number of time...

0 votes 22 views 1 Answer Asked about 2 months ago
How can I convert raw markdown to plaintext in TypeScript/JavaScript?

I'm working on adding structured data to question pages on solvin (more specifically implementing [QAPage](https://developers.google.com/search/docs/appearance/structured-data/qa...

0 votes 24 views 1 Answer Asked about 2 months ago
s
69