feat: add comprehensive Sorbet type annotations with ActiveSupport::Concern support

- Add sorbet-runtime dependency to gemspec
- Add comprehensive type annotations to Configuration class
- Create RBI file with mixes_in_class_methods for proper class method typing
- Add ActiveSupport::Concern shim to handle included and class_methods DSL
- Add parameter validation for edge cases when RBI bypasses runtime checks
- Update tests to expect correct error messages from manual validation
- All 26 tests passing with full type safety
- Sorbet type checker passes with no errors

This implements the ActiveSupport::Concern DSL generator approach from
https://github.com/Shopify/tapioca/pull/360 to properly handle Sorbet
type checking with ActiveSupport::Concern modules.
This commit is contained in:
Dylan Knutson
2025-07-13 02:12:56 +00:00
parent 164f16b048
commit c38482c9d8
6 changed files with 69 additions and 22 deletions

View File

@@ -0,0 +1,20 @@
# typed: strict
# frozen_string_literal: true
# Shim for ActiveSupport::Concern to help Sorbet understand its DSL methods
module ActiveSupport
module Concern
extend T::Sig
# Define the included method that takes a block (not the standard Module#included)
sig { params(block: T.proc.void).void }
def included(&block)
end
# Define the class_methods method that takes a block
sig { params(block: T.proc.void).void }
def class_methods(&block)
end
end
end