SchemaStore narrowed to never
Currently trying the example in the readme, not sure if this is a vscode bug but it's narrowing the store's type to
never
:
16 Replies
not sure if it's something on vscode's side since I don't use it quite often anyways, maybe I missconfigured something
this is what it says in the last
#add()
, where it gets narrowed downremoving only that last one correctly types it as SchemaStore, and
#serialize()
no longer type errors@kyra 🩵🩷🤍🩷🩵
guess I'll have to wait for a while
because I just talked to kyra right before they were going to bed like a few hours ago lol
awesome library though, it's the perfect customId builder
I wish I was still sleeping but I have to be up to start the day to be on time at the conference I'm going to 😭
oh, adding a const assertion fixes it
Solution
aka
must be because that way the store's keys don't get widened to
number
but to the numeric constants insteadOh, right
Yeah that makes a lot of sense
By the way, you can alternatively use
enum
if you're using TS 👀I personally prefer const objects
though that's the example from the readme, I was just copying it lol
it's missing the const assertion
btw if I wanted to ask about design choices when using the library, should I ask in this channel (other thread)?
since it's not really about issues about the library itself but how it's implemented on my side
If they’re support questions, a separate thread. If they’re development questions, I’d say in #utilities-development
We use AnswerOverflow here, so it’s best to keep threads single-topic
Speaking of which, don’t forget this 👀
almost forgot, thanks
thanks! unrelated question but could I by chance get a reply in #Serializing string-store result inside another schema :crySparkle:
Yeah I'm on it