Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid type for Tapioca::Dsl::Helpers::ActiveRecordColumnTypeHelper#column_type_for #1997

Closed
cquinones100 opened this issue Aug 20, 2024 · 2 comments · Fixed by #2015
Closed
Assignees
Labels
bug Something isn't working good-first-issue Good for newcomers

Comments

@cquinones100
Copy link
Contributor

cquinones100 commented Aug 20, 2024

@constant.primary_key can be nil for models that don't have a primary key, so this sig should be updated to the following:

sig { params(column_name: T.nilable(String)).returns([String, String]) }
  def column_type_for(column_name)

I discovered this issue when requiring sorbet-runtime as part of bin/tapioca. I think we can make this change without downstream effects since the runtime behavior tolerates nil. I'm happy to make a PR to implement this if there are no concerns.

@cquinones100 cquinones100 changed the title Invalid type for Tapioca::Dsl::Helpers::ActiveRecordColumnTypeHelper#id_type Invalid type for Tapioca::Dsl::Helpers::ActiveRecordColumnTypeHelper#column_type_for Aug 20, 2024
@amomchilov amomchilov changed the title Invalid type for Tapioca::Dsl::Helpers::ActiveRecordColumnTypeHelper#column_type_for Invalid type for Tapioca::Dsl::Helpers::ActiveRecordColumnTypeHelper#column_type_for Sep 4, 2024
@amomchilov amomchilov added bug Something isn't working good-first-issue Good for newcomers labels Sep 4, 2024
@amomchilov
Copy link
Contributor

Hey @cquinones100, nice catch, thanks for reporting this.

Would you be interesting in submitting a PR for this? It would make for a great first contribution!

@cquinones100
Copy link
Contributor Author

PR submitted, thanks @amomchilov!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working good-first-issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants