I am using typed dictionary to pass on a multitude of parameters to a few classes.
I have the dictionary typed like below, and an access for function that is typed with a separate type containing all the possible values. Is there a way to make this more efficient, i.e. refer to all the value types of the dictionary instead of duplicating them in a separate value type? (it is actually 18 different keys, so it is a bit messy)
typedef DbOptions as { :key1 as Numeric?, :key2 as String? }; typedef DbOptionValue as Numeric or String or Null; class Db { private var _options as DbOptions; public function getOption( option as Symbol ) as DbOptionValue { return _options[option] as DbOptionValue; } }