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

Update exported signature of MigrationFunction #1274

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

royalrex
Copy link

Summary

Changing of MigrationFunction type. The context parameter should not be declared as optional.

Description

This PR removes the optional setting on the context parameter. This will hint typescript that the parameter will always be there. My research of your codebase indicates that the context will always be provided.

I assume that your intent with marking the context as optional, is to not force other developers to have context parameter present in their migration function signature. But that is not what is happening. Typescript is okay with "missing" parameters, but marking it optional as is, will force developers to null check the context object before using. This seems to be not needed.

Motivation and Context

Improves typescript type checking.

Todos

  • Implemented feature
  • Feature with pending implementation

Screenshots (if appropriate):

Typescript before change with context parameter
image

Typescript after change with context parameter
image

Typescript after change with no context parameter
image

@royalrex royalrex requested a review from a team as a code owner November 28, 2023 11:03
Copy link
Contributor

@mgoudy91 mgoudy91 left a comment

Choose a reason for hiding this comment

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

I took a look and came to the same conclusion and believe this is fairly safe (and correct).

Thanks for the contribution!

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.

2 participants