Class: Rbs2ts::Converter::Types::Union

Inherits:
ConverterBase show all
Defined in:
lib/rbs2ts/converter/types.rb

Instance Method Summary collapse

Methods inherited from ConverterBase

#initialize

Constructor Details

This class inherits a constructor from Rbs2ts::Converter::Types::ConverterBase

Instance Method Details

#to_tsObject



106
107
108
109
110
111
112
113
# File 'lib/rbs2ts/converter/types.rb', line 106

def to_ts
  types_ts = type.types.map { |type|
    ts = Types::Resolver.to_ts(type)
    type.is_a?(::RBS::Types::Optional) ? "(#{ts})" : ts
  }

  types_ts.join(' | ')
end