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:
20
sorbet/rbi/shims/active_support_concern.rbi
Normal file
20
sorbet/rbi/shims/active_support_concern.rbi
Normal 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
|
||||
Reference in New Issue
Block a user