#Is there any way to access a non-existent property without an error ?

6 messages · Page 1 of 1 (latest)

tepid spade
gray zephyr
#

maybe something like this?

for (const iterator of typeFlagsOfUnions) {
  if (iterator in literalToPrimitiveTypeFlags) {

  }
}
gray zephyr
#
  literalToPrimitiveTypeFlags[iterator as keyof typeof literalToPrimitiveTypeFlags] 
#

a bit ugly but it works