#using the union type,

4 messages · Page 1 of 1 (latest)

pseudo marten
#

whats the rule/guideline for using union type? ie if theres a variable that should only ever be 1 of 6 different strings should i use it then? what if it was 30?
also just to clarify using the union type doesnt get rid of needing to verify that the input data matches one of the 6 options before assigning

wary spire
#

use unions where they make sense

#

if those 30 possible strings are significant in terms of types, then you'd put that in a union somehow

#

if you have essentially a 30-member enum that would still be represented as a union, it just means you have design issues that resulted in that massive enum to begin with