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

Enforce explicit function return type #383

Merged
merged 2 commits into from
Mar 15, 2024
Merged

Conversation

wjhsf
Copy link
Contributor

@wjhsf wjhsf commented Mar 15, 2024

The primary motivation is to help with #380; enforcing an explicit return type helps us identify which functions return null / undefined and therefore standardize on one value as much as possible.

A secondary motivation is that it technically makes type checks faster, as parsing function bodies is no longer necessary to infer the return type. However, given the current size/state of our code, there's no discernible performance gain by enforcing this rule.

It results in faster type checking and helps us identify usage of null vs undefined.
Copy link
Contributor

@colincasey colincasey left a comment

Choose a reason for hiding this comment

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

Good call to enable the explicit return type rule.

@wjhsf wjhsf merged commit 07c6b13 into master Mar 15, 2024
6 checks passed
@wjhsf wjhsf deleted the explicit-function-return-type branch March 15, 2024 20:53
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.

None yet

2 participants