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

@@ -45,13 +45,11 @@ pre-commit:
json-lint:
glob: "*.json"
exclude: |
.devcontainer/devcontainer.json
.vscode/settings.json
run: |
for file in {staged_files}; do
# Skip devcontainer.json files which use JSONC format
if [ "$(echo "$file" | grep -c 'devcontainer.json')" -gt 0 ] || [ "$(echo "$file" | grep -c '.vscode')" -gt 0 ]; then
echo "Skipping JSONC file: $file"
continue
fi
echo "Checking $file"
ruby -e "require 'json'; JSON.parse(File.read('$file'))" || exit 1
done