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

[Flow] Type exports for data/* #11472

Merged
merged 4 commits into from
Feb 4, 2022
Merged

[Flow] Type exports for data/* #11472

merged 4 commits into from
Feb 4, 2022

Conversation

mourner
Copy link
Member

@mourner mourner commented Feb 4, 2022

A part of #11426. Adds missing export types for files in src/data/* apart from array_types.js which is in #11470.

@mourner mourner requested a review from karimnaaji February 4, 2022 15:37
@mourner mourner added the skip changelog Used for PRs that do not need a changelog entry label Feb 4, 2022
@mourner mourner changed the title [Flow] Type exports for data/bucket/* [Flow] Type exports for data/* Feb 4, 2022
Copy link
Contributor

@karimnaaji karimnaaji left a comment

Choose a reason for hiding this comment

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

Looks good, I have one question about style to follow for inline type going forward.

@@ -598,7 +598,7 @@ class SymbolBucket implements Bucket {
}
}

addToLineVertexArray(anchor: Anchor, line: any) {
addToLineVertexArray(anchor: Anchor, line: any): {| lineLength: number, lineStartIndex: number |} {
Copy link
Contributor

@karimnaaji karimnaaji Feb 4, 2022

Choose a reason for hiding this comment

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

What style should we follow concerning inlined anonymous type? I sometimes find it nice to read a named type instead (e.g. addToLineVertexArray(anchor: Anchor, line: any): LineVertexRange) as a hint to what it is. This can also reduce very long function signature like here.

We don't have to switch all of the ones we already have, but since we're going to add a lot of these now I wonder if we should adopt a particular convention.

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point — this return type was auto-generated, but I agree that extracting it into a named type makes it more readable (and perhaps it will be useful in the future once we need to specify this type in other files). Fixed.

@mourner mourner requested a review from karimnaaji February 4, 2022 16:40
@mourner mourner merged commit 8dde786 into main Feb 4, 2022
@mourner mourner deleted the flow/bucket branch February 4, 2022 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
skip changelog Used for PRs that do not need a changelog entry
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants