How to make discriminated union exhaustive while using t
I wanted to start adding custom rules depending on the game mode selected (right now only standard and tournament mode are available) but for demonstration purposes I added a "crazy" mode to show my problem. How can I enforce that my
isGameOptions
contains all game modes in the GAME_MODES array? This code would work without errors10 Replies
do you use flamework?
no
can you make an empty project with flamework template, generate the t from type and take it from compiled code?
^ i think it's gonna be way easier cause you can define the structure in the type and the flamework will do the figuring out for t structure
i cant exactly migrate to flamework but i think i can make a guard
this seems to work. would you have any better ideas?
preferably it would throw a typeError instead of just defaulting to never but i am unfortunately not a type wizard
can you ask ai to make a type?
i usually do that if the type is complex 🙄
Unknown User•2mo ago
Message Not Public
Sign In & Join Server To View
is there a smaller package i could use for that?
is it
@flamework/networking
Wdym? So you want it for networking?
I think flamework is 3 packages
@flamework/core (has to be all the time)
@flamework/networking
@flamework/components
Or it might be 4 cause flamework has a transformer I think, or it's embedded in core
i want the type guards
Solution
Apparently flamework/core is enough