rbs
rbs copied to clipboard
RBS support for delegate
Hey. We use SimpleDelegator but I can't reference it in any of my RBS files. Would this be feasible to add?
Thanks for reporting the issue.
Currently, RBS has no support for delegate library.
I have a plan to support delegate by RBS with two steps.
First, add the type definitions of delegate to ruby/rbs repository.
By this change, SimpleDelegator class's RBS will be available. Then type checking will be green on class MyDelegator < SimpleDelegator definition.
Second, provide the delegated methods' RBSs. For example, an object created by SimpleDelegator.new([]) should have the same methods as Array, but it doesn't even if we apply the first step.
I guess we need an RBS generator but I haven't thought about it deeply yet.
@pocke Thanks for explanation.
Thanks both for responding. Should this issue be left open until implemented, or moved to ruby/rbs repo?
I've transferred this issue to ruby/rbs repo :rocket:
This might be related https://github.com/ruby/rbs/pull/765