Optional types masking type unions, fixes #341