Class: Rbs2ts::Converter::Types::Intersection

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



117
118
119
120
121
122
123
124
# File 'lib/rbs2ts/converter/types.rb', line 117

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

  types_ts.join(' & ')
end