Skip to content

ActionView::Helpers::RenderingHelper#render has incorrect block signature #67

Description

@clinejj

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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions