79694362

Date: 2025-07-08 14:03:00
Score: 1
Natty:
Report link

Do I always need to re-declare the sig { ... } in every subclass that overrides a method, even if the types are identical?

Yes.

Sorbet never infers the signature of a method. If you want a method’s parameters and return to have types, they must be declared explicitly.

There is more about this in the docs:

https://sorbet.org/docs/why-type-annotations

Note that Sorbet can suggest sig annotations if you ask it to, and the suggested sigs will use information from any parent method if available:

https://sorbet.org/docs/sig-suggestion

Do I need override?

If a parent method is declared abstract or overridable and then is overridden by a child method that has a sig, then the child method must also include the override annotation:

https://sorbet.org/docs/override-checking

Reasons:
  • Blacklisted phrase (0.5): I need
  • Long answer (-0.5):
  • No code block (0.5):
  • Contains question mark (0.5):
Posted by: jez