lib/rbs2ts/converter/declarations.rb in rbs2ts-1.2.0 vs lib/rbs2ts/converter/declarations.rb in rbs2ts-1.3.0
- old
+ new
@@ -33,11 +33,11 @@
def to_ts
''
end
def name
- declaration.name.to_s.gsub(/:/, '')
+ declaration.name.name.to_s.gsub(/:/, '')
end
private
attr_reader :declaration
@@ -57,10 +57,12 @@
.chomp
end
def member_to_ts(member)
case member
+ when ::RBS::AST::Members::InstanceVariable then
+ Converter::Members::InstanceVariable.new(member).to_ts
when ::RBS::AST::Members::AttrReader then
Converter::Members::AttrReader.new(member).to_ts
when ::RBS::AST::Members::AttrWriter then
Converter::Members::AttrWriter.new(member).to_ts
when ::RBS::AST::Members::AttrAccessor then
@@ -87,9 +89,20 @@
.chomp
end
def member_to_ts(member)
case member
+ when ::RBS::AST::Declarations::Class then
+ Converter::Declarations::Class.new(member).to_ts
+ when ::RBS::AST::Declarations::Module then
+ Converter::Declarations::Module.new(member).to_ts
+ when ::RBS::AST::Declarations::Interface then
+ Converter::Declarations::Interface.new(member).to_ts
+ when ::RBS::AST::Declarations::Alias then
+ Converter::Declarations::Alias.new(member).to_ts
+ when ::RBS::AST::Members::InstanceVariable
+ ts = Converter::Members::InstanceVariable.new(member).to_ts
+ "export declare let #{ts}"
when ::RBS::AST::Members::MethodDefinition
ts = Converter::Members::MethodDefinition.new(member).to_ts
"export declare function #{ts}"
else
''