#Type depends on type of other var, how?

4 messages · Page 1 of 1 (latest)

minor tapir
#
const value: Item[] | Item | null | undefined
const isArray?: boolean

Is it possible to have the tpe of value set to either (Item[] | null | undefined) | (Item | null | undefined) depending on isArray?

lime mortar
#

no, since they aren't linked at all here

minor tapir
#

hm, could have been a nice feature.

weak idol
#

you can pack them into an object if you want to encode this relationship