-
Notifications
You must be signed in to change notification settings - Fork 127
Open
Description
When calling the #render
method from a helper in a Rails app, for example:
module ApplicationHelper
def render_partial(name, options)
render(partial: name, **options)
end
end
the current type definitions throw an error when validating in Steep due to an incorrect signature:
rbs:
module ApplicationHelper : ActionView::Helpers
def render_partial: (String name, Hash[Symbol, untyped] options) -> String
end
steep output:
[error] The method cannot be called without a block
│ Diagnostic ID: Ruby::RequiredBlockMissing
│
└ render(
~~~~~~
This specific one comes from ActionView::Helpers::RenderingHelper#render
, which is defined on https://github.com/ruby/gem_rbs_collection/blob/main/gems/actionview/6.0/actionview-generated.rbs#L6603
def render: (?::Hash[untyped, untyped] options, ?::Hash[untyped, untyped] locals) { () -> untyped } -> untyped
The patch to fix it is to make the block optional, ie ?{ () -> untyped }
I'm happy to make a PR to address, but not sure if you would prefer to update the generated files or the patch.
Metadata
Metadata
Assignees
Labels
No labels