how would i runtime typecheck an interface with dynamic keys?
my initial attempt was something like this
16 Replies
t.mapuh where? here are my types
hmm thanks!
the type would be as
Map thoughis there a way for t to infer from just the types?
which might not be ideal
you'd need to typecast it
not really, flamework has a transformer for it
if it works good enough sure
would crates state be a map? is there like a difference between CratesState and Map<string, CratesEntity>
yes, usually for those types it's better to use a map
when compiled it compiles to the same table
i feel like im being forceful here
whats the better approach
maybe you can create an util function that just uses map
and returns an interface-like
or directly use a map, but it might have some disadvantages
on the types? or checks
so like just use maps for my types?
the function would just use map, but it would cast to a { [K]: V }
so you dont need to do
as unknown as everytimewhat does the function work with, the actual data? or the checks
sorry, im pretty new to these concepts
oh so just do the as unknown as inside the util function
alright thanks!