#How do I create a signal that can be a value or null?

5 messages · Page 1 of 1 (latest)

mossy forge
#

I tried doing:

const [val, setVal] = createSignal<string | null>(null)

but then val is infered as Accessor<string>

marble wave
#

Sounds like you have to set strict: true in your tsconfig

mossy forge
marble wave
#

Imo they should just remove strict: false. Idk what typescript without null and undefined in its types 🤷‍♀️