-
Notifications
You must be signed in to change notification settings - Fork 36
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
feat(core): Add flow types, flow build step, type tests #21
Conversation
This is currently using the dist flow files to run the type checking tests. I'm not sure if that's the right thing. They're just copies of src/index.js.flow, so maybe the tests should just run against that. Is this a part of my secret plan to remove the dist folder from the repo? perhaps ... |
Ok, I added types for combine, combineArray, zip, and zipArray. Varargs combine, and zip weren't too bad. I ran into a question about combineArray and zipArray, though. I wasn't sure whether to provide a "catch-all" version that allows arbitrary length arrays at the cost of giving up type checking on the array, see here. I saw that xstream does the same. I have no idea if there's a better way in flow, but I can't think of one. I went to arity 6. It's purely mechanical to go higher if we feel like we should. Opinions? |
c3dc80d
to
8106b2c
Compare
I think this is ready for review. We may want to expand the type tests, but also may want to do that in another PR in order to get this merged sooner. Totally open to discussion, tho. |
8106b2c
to
7b4274e
Compare
Rebased |
dispose: () => ?Promise<any> | ||
} | ||
|
||
// A Timer can scheduler a function to run after |
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.
minor typo scheduler
-> schedule
. Silly, I know 😄
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.
D'oh! fixed
7b4274e
to
38e7b66
Compare
AFFECTS: @most/core * Add flow types, build step, type tests * Add missing flow-bin devDep * Add sample, combine, combineArray, zip, zipArray * Run type check tests against src * chore(dist): Re-remove dist files AFFECTS: @most/core * docs(index.js.flow): Fix typo AFFECTS: @most/core
Add flow type definitions for the public API. The goal is to provide near term type safety value for consumers. This doesn't touch the much larger task of adding type annotations to the implementation.
What's here:
flow check
ed bynpm test
, and it will fail if type checking fails. Fail CI if types are invalid FTWWhat's (intentionally) not here:
Interesting or controversial things we may want to discuss:
newScheduler (timer: Timer, timeline: Timeline): Scheduler
, which returns something of the typeScheduler
.