Wes
Explore posts from serversAll of a sudden `classList` is typed as string | undefined
I am using SolidJS with Astro and at one point I duplicated a component file to extract logic into it and now
class
and classList
have unexpected types:
The reference is node_modules/.pnpm/[email protected]/node_modules/solid-js/types/jsx.d.ts and it does only contain:
What's going on?!58 replies
How to create a nested menu from a nested object?
I'm building a system where I have data from an external source that is structured as an object with nested levels, such as:
It can have an arbitrary number of options and submenus.
How do I make a
<Menu />
component that reacts to this object and renders recursively?
My current solution is passing the properties after reading them, which is not reactive and therefore never updates.12 replies
How to better handle `from`'s possible `undefined` state?
I'm using
from
to observe a value from an external source. Because that's an observed value, it will be undefined at start.
Further in my code I am using the value, for instance on a <Match>
:
The problem here is that volume()
is possibly undefined, which makes TypeScript mad because comparing undefined with number is a sin.
Did I choose the wrong pattern nere? Do I need to further wrap the volume accessor in a memo to guarantee an initial value?
Shouldn't it be possible to set the initial value as such?
8 replies
Cannot find name 'React' when using Astro + TypeScript
I configured my Astro project to use SolidJS and even though I added the required
tsconfig.json
VSCode highlights every JSX tag with an error:
Cannot find name 'React'.ts(2304)
Astro compiles and runs fine, and tsc --noEmit
also shows no errors.
Am I missing something?7 replies