Skip to content

Conversation

alexdunae
Copy link

Motivation

I was migrating from sorbet-rails and couldn't find a migration path for RelationType. I searched the Slack channel and came up with this suggestion. I figured it would be helpful to others.

Implementation

n/a

Tests

just docs

@alexdunae alexdunae requested a review from a team as a code owner November 8, 2022 18:02
@alexdunae
Copy link
Author

I've just signed the CLA

Copy link
Contributor

@KaanOzkan KaanOzkan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good to me but I'm not 100% sure on its placement. We can add it to https://github.com/Shopify/tapioca/wiki/Migrating-to-Tapioca as well.

You'll also have to update the documentation on the compiler file itself.

end
~~~

As the name suggests, this will give you type checking during development but disable it at runtime.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be beneficial to give a bit more information here about how Tapioca defines methods on PrivateRelation that returns a Post type. For example, the first! method. That's why this approach gives more static typing benefits.

But I didn't use sorbet-rails and if you think this information is already assumed by an existing sorbet-rails user than it's okay to omit it.

@fazo96
Copy link

fazo96 commented Oct 27, 2023

This looks like it could be a solution for #1140

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants