-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Conversation
There was a problem hiding this 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.
src/data/bucket/symbol_bucket.js
Outdated
@@ -598,7 +598,7 @@ class SymbolBucket implements Bucket { | |||
} | |||
} | |||
|
|||
addToLineVertexArray(anchor: Anchor, line: any) { | |||
addToLineVertexArray(anchor: Anchor, line: any): {| lineLength: number, lineStartIndex: number |} { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
A part of #11426. Adds missing export types for files in
src/data/*
apart fromarray_types.js
which is in #11470.