Skip to content

Commit 2bd6a40

Browse files
justin808claude
andcommitted
Fix RBS type signatures based on feedback
- Add optional block parameters to react_component, react_component_hash, and internal_react_component helper methods to support yielding in view code - Change Controller#redux_store immediate_hydration parameter from bool? to bool to disallow explicit nil (nil is handled via parameter omission) - Fix PrerenderError to use attr_reader instead of attr_accessor - Mark PrerenderError attributes as optional types (String?, Hash?, Array?) - Add missing attr_readers (component_name, props, console_messages) - Add missing public methods (to_honeybadger_context, raven_context, to_error_context) All changes improve type accuracy and match actual Ruby implementation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ec29344 commit 2bd6a40

File tree

3 files changed

+14
-12
lines changed

3 files changed

+14
-12
lines changed

sig/react_on_rails.rbs

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,23 @@ module ReactOnRails
1313
end
1414

1515
class PrerenderError < Error
16-
attr_accessor js_code: String?
17-
attr_accessor err: Hash[Symbol, untyped]
18-
attr_accessor js_message: String
16+
attr_reader component_name: String?
17+
attr_reader js_code: String?
18+
attr_reader err: Hash[Symbol, untyped]?
19+
attr_reader props: (Hash[Symbol, untyped] | String)?
20+
attr_reader console_messages: Array[String]?
1921

2022
def initialize: (
2123
?component_name: String?,
2224
?js_code: String?,
23-
?err: Hash[Symbol, untyped],
25+
?err: Hash[Symbol, untyped]?,
2426
?props: (Hash[Symbol, untyped] | String)?,
25-
?js_message: String
27+
?console_messages: Array[String]?
2628
) -> void
2729

28-
def console_messages: () -> Array[String]
29-
def base_message: () -> String
30-
def build_message: () -> String
30+
def to_honeybadger_context: () -> Hash[Symbol, untyped]
31+
def raven_context: () -> Hash[Symbol, untyped]
32+
def to_error_context: () -> Hash[Symbol, untyped]
3133
end
3234

3335
class JsonParseError < Error

sig/react_on_rails/controller.rbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module ReactOnRails
33
def redux_store: (
44
String store_name,
55
?props: untyped,
6-
?immediate_hydration: bool?
6+
?immediate_hydration: bool
77
) -> void
88

99
def redux_store_hydration_data: () -> String

sig/react_on_rails/helper.rbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ module ReactOnRails
66
def react_component: (
77
String component_name,
88
?Hash[Symbol, untyped] options
9-
) -> String
9+
) ?{ () -> untyped } -> String
1010

1111
def react_component_hash: (
1212
String component_name,
1313
?Hash[Symbol, untyped] options
14-
) -> Hash[String, String]
14+
) ?{ () -> untyped } -> Hash[String, String]
1515

1616
def redux_store: (
1717
String store_name,
@@ -36,7 +36,7 @@ module ReactOnRails
3636
def internal_react_component: (
3737
String component_name,
3838
Hash[Symbol, untyped] options
39-
) -> Hash[Symbol, untyped]
39+
) ?{ () -> untyped } -> Hash[Symbol, untyped]
4040

4141
def build_react_component_result_for_server_rendered_string: (
4242
server_rendered_html: String,

0 commit comments

Comments
 (0)