class Rbs2ts::Converter::Types::Array

Public Instance Methods

to_ts() click to toggle source
# File lib/rbs2ts/converter/types.rb, line 145
def to_ts
  array_type = type.args.first
  array_type_ts = Types::Resolver.to_ts(array_type)

  if array_type.is_a?(::RBS::Types::Union) ||
    array_type.is_a?(::RBS::Types::Intersection) ||
    array_type.is_a?(::RBS::Types::Optional)
    "(#{array_type_ts})[]"
  else
    "#{array_type_ts}[]"
  end

end