Skip to content

Commit cd0d8ac

Browse files
Reduce number of untyped in rbs
1 parent 9f3fed3 commit cd0d8ac

File tree

3 files changed

+33
-34
lines changed

3 files changed

+33
-34
lines changed

lib/ruby_wasm/build/downloader.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def format_size(size)
1212

1313
def download(url, dest, message)
1414
require "open-uri"
15-
content_length = nil
15+
content_length = 0
1616
uri = URI.parse(url)
1717
OpenURI.open_uri(
1818
uri,

lib/ruby_wasm/build/product/openssl.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
module RubyWasm
55
class OpenSSLProduct < AutoconfProduct
6-
attr_reader :target, :install_task
6+
attr_reader :target
77

88
OPENSSL_VERSION = "3.0.5"
99

sig/ruby_wasm/build.rbs

Lines changed: 31 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
module RubyWasm
22
VERSION: String
33

4-
class BuildParams < Struct[untyped]
5-
attr_accessor name(): String
6-
attr_accessor target(): String
7-
attr_accessor default_exts(): String
4+
class BuildParams
5+
attr_accessor name: String
6+
attr_accessor target: String
7+
attr_accessor default_exts: String
88
end
99

1010
class BuildProduct
@@ -30,17 +30,17 @@ module RubyWasm
3030

3131
def initialize: (untyped params, String build_dir) -> void
3232
def name: -> String
33-
def cache_key: (Digest::SHA256 digest) -> Digest::SHA256
33+
def cache_key: (Digest::SHA256 digest) -> void
3434
def src_dir: -> String
3535
def configure_file: -> String
36-
def fetch: (BuildExecutor executor) -> Array[untyped]
36+
def fetch: (BuildExecutor executor) -> void
3737
def build: (BuildExecutor executor) -> void
3838
end
3939

4040
class BaseRubyProduct < BuildProduct
4141
@build_dir: String
4242
@source: BuildSource
43-
@channel: untyped
43+
@channel: String
4444

4545
def initialize: (String build_dir, BuildSource source) -> void
4646
def product_build_dir: -> String
@@ -54,7 +54,7 @@ module RubyWasm
5454
@build_dir: String
5555

5656
attr_reader target: String
57-
def initialize: (String build_dir, untyped target, Emscripten | WASISDK toolchain) -> void
57+
def initialize: (String build_dir, String target, Emscripten | WASISDK toolchain) -> void
5858
def product_build_dir: -> String
5959
def destdir: -> String
6060
def install_root: -> String
@@ -68,7 +68,7 @@ module RubyWasm
6868
@build_dir: String
6969

7070
attr_reader target: String
71-
def initialize: (String build_dir, untyped target, Emscripten | WASISDK toolchain) -> void
71+
def initialize: (String build_dir, String target, Emscripten | WASISDK toolchain) -> void
7272
def product_build_dir: -> String
7373
def destdir: -> String
7474
def install_root: -> String
@@ -81,8 +81,7 @@ module RubyWasm
8181
@build_dir: String
8282

8383
attr_reader target: String
84-
attr_reader install_task: untyped
85-
def initialize: (String build_dir, untyped target, Emscripten | WASISDK toolchain) -> void
84+
def initialize: (String build_dir, String target, Emscripten | WASISDK toolchain) -> void
8685
def product_build_dir: -> String
8786
def destdir: -> String
8887
def install_root: -> String
@@ -110,18 +109,18 @@ module RubyWasm
110109
end
111110

112111
class CrossRubyExtProduct < BuildProduct
113-
@toolchain: untyped
114-
@srcdir: untyped
112+
@toolchain: Toolchain
113+
@srcdir: String
115114

116115
attr_reader name: String
117-
def initialize: (untyped srcdir, untyped toolchain, ?name: nil) -> void
118-
def product_build_dir: (untyped crossruby) -> String
119-
def linklist: (untyped crossruby) -> String
120-
def make_args: (untyped crossruby) -> Array[String]
121-
def build: (BuildExecutor executor, untyped crossruby) -> void
122-
def do_extconf: (BuildExecutor executor, untyped crossruby) -> untyped
123-
def do_install_rb: (BuildExecutor executor, untyped crossruby) -> untyped
124-
def cache_key: (untyped digest) -> Array[String]
116+
def initialize: (String srcdir, Toolchain toolchain, ?name: nil) -> void
117+
def product_build_dir: (CrossRubyProduct crossruby) -> String
118+
def linklist: (CrossRubyProduct crossruby) -> String
119+
def make_args: (CrossRubyProduct crossruby) -> Array[String]
120+
def build: (BuildExecutor executor, CrossRubyProduct crossruby) -> void
121+
def do_extconf: (BuildExecutor executor, CrossRubyProduct crossruby) -> void
122+
def do_install_rb: (BuildExecutor executor, CrossRubyProduct crossruby) -> void
123+
def cache_key: (Digest::SHA256 digest) -> void
125124
end
126125

127126
class CrossRubyProduct < AutoconfProduct
@@ -144,13 +143,13 @@ module RubyWasm
144143
attr_accessor debugflags: Array[String]
145144
attr_accessor xcflags: Array[String]
146145
attr_accessor xldflags: Array[String]
147-
def initialize: (BuildParams params, String build_dir, String rubies_dir, BaseRubyProduct baseruby, BuildSource source, Emscripten | WASISDK toolchain, ?user_exts: Array[untyped]) -> void
148-
def configure: (BuildExecutor executor, ?reconfigure: bool) -> untyped
146+
def initialize: (BuildParams params, String build_dir, String rubies_dir, BaseRubyProduct baseruby, BuildSource source, Emscripten | WASISDK toolchain, ?user_exts: Array[CrossRubyExtProduct]) -> void
147+
def configure: (BuildExecutor executor, ?reconfigure: bool) -> void
149148
def build_exts: (BuildExecutor executor) -> bool?
150149
def build: (BuildExecutor executor, ?remake: bool, ?reconfigure: bool) -> bool?
151150
def clean: (BuildExecutor executor) -> void
152151
def name: -> String
153-
def cache_key: (Digest::SHA256 digest) -> Array[untyped]
152+
def cache_key: (Digest::SHA256 digest) -> void
154153
def build_dir: -> String
155154
def ext_build_dir: -> String
156155
def with_libyaml: (LibYAMLProduct libyaml) -> LibYAMLProduct
@@ -166,12 +165,12 @@ module RubyWasm
166165
end
167166

168167
class WitBindgen
169-
@build_dir: untyped
168+
@build_dir: String
170169
@tool_dir: String
171170
@revision: String
172171

173172
attr_reader bin_path: String
174-
def initialize: (build_dir: untyped, ?revision: String) -> void
173+
def initialize: (build_dir: String, ?revision: String) -> void
175174
def install: -> void
176175
end
177176

@@ -183,7 +182,7 @@ module RubyWasm
183182
def initialize: -> void
184183
def find_tool: (Symbol name) -> bot
185184
def check_envvar: (untyped name) -> nil
186-
def self.get: (untyped target, ?String? build_dir) -> (Emscripten | WASISDK)
185+
def self.get: (String target, ?String? build_dir) -> (Emscripten | WASISDK)
187186
def self.find_path: (String command) -> String?
188187
def self.check_executable: (String command) -> String
189188
def cc: -> nil
@@ -233,26 +232,26 @@ module RubyWasm
233232
end
234233

235234
class Downloader
236-
def format_size: (untyped size) -> untyped
235+
def format_size: (Integer size) -> String
237236

238-
def download: (untyped url, untyped dest, untyped message) -> untyped
237+
def download: (String url, String dest, String message) -> void
239238
end
240239

241240
class BuildTask
242241
@build_dir: String
243242
@rubies_dir: String
244243
@openssl: OpenSSLProduct
245244

246-
attr_accessor name: untyped
245+
attr_accessor name: String
247246
attr_reader source: BuildSource
248-
attr_reader target: untyped
247+
attr_reader target: String
249248
attr_reader toolchain: Emscripten | WASISDK
250249
attr_reader libyaml: LibYAMLProduct
251250
attr_reader zlib: ZlibProduct
252251
attr_reader wasi_vfs: WasiVfsProduct
253252
attr_reader baseruby: BaseRubyProduct
254253
attr_reader crossruby: CrossRubyProduct
255-
def initialize: (untyped name, target: untyped, src: untyped, ?toolchain: nil, ?build_dir: nil, ?rubies_dir: nil, **untyped) -> void
254+
def initialize: (String name, target: String, src: untyped, ?toolchain: Toolchain?, ?build_dir: String?, ?rubies_dir: String?, **untyped) -> void
256255
def hexdigest: -> String
257256
end
258257
end

0 commit comments

Comments
 (0)