Skip to content

RBS: Narrow type signatures for props parameters #1951

@justin808

Description

@justin808

Summary

Several RBS type signatures currently use untyped for props parameters, but could be more precise.

Current Signatures

# In sig/react_on_rails/helper.rbs
def react_component: (
  String component_name,
  ?Hash[Symbol, untyped] options
) ?{ () -> untyped } -> safe_buffer

# In sig/react_on_rails/controller.rbs
def redux_store: (
  String store_name,
  ?props: untyped,
  ?immediate_hydration: bool
) -> void

Proposed Improvement

?props: (Hash[Symbol, untyped] | String)

Benefits

  • More precise type checking
  • Still accepts both common formats (Hash or JSON string)
  • Better IDE support and autocomplete
  • Catches type errors earlier

Related

Follow-up to PR #1945 - post-merge code review feedback

References

  • lib/react_on_rails/helper.rb - props can be Hash or String
  • lib/react_on_rails/controller.rb - similar pattern

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions