#Extract all possible strings from nested array

8 messages · Page 1 of 1 (latest)

weak timber
#

when you annotate the variable's type as DatabaseEntityEntry[] that's all it ever will be. your EntityNames type is equivalent to this:

type EntityNames = DatabaseEntityEntry[1][0];

perhaps you want to use the satisfies operator rather than a type annotation? or neither and just let type inference take care of things

harsh ledge
#

Type manipulation works on the type level, it can only see what's available in the type

supple rapids
#

You're basically giving up your as const by making it DatabaseEntityEntry[]

harsh ledge
#

If that information is lost, then there's no way to get it.

weak timber
#

yeah, that's what i was trying to say. why do you have the : DatabaseEntityEntry[] annotation there?

supple rapids
#

Yeah exactemundo

weak timber
#

if you expect to make mistakes in the definition of DatabaseEntities that won't easily be caught elsewhere, remove the type annotation and replace with satisfies like i said

#

if that's not a real concern, just remove it and don't do anything else