Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
clinejj opened this issue Oct 6, 2021 · 0 comments

Comments

@clinejj
Copy link

clinejj commented Oct 6, 2021

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant