-
Notifications
You must be signed in to change notification settings - Fork 12
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
Modernizing and using flowtype #60
Conversation
is there any way to do this in pieces or is the plan to make the changes all at once? |
We can do this in pieces, I thought I would publish this since we started tackling the same stuff. I was trying to see how flowtype would fit into the project an started fixing all the things it started giving me errors about. |
* @param {String} id - the bucket object id to fetch | ||
* @param {bucketStoreGetCallback} - callback once the object is fetched | ||
*/ | ||
get( id: string, callback: ( ?Error, ?BucketObject ) => void ): void; |
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.
why not standardize on a Promise interface? that would let people more easily use async/await
too
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.
Thats the goal, this is just keeping backwards compatibility right now.
src/simperium/bucket.js
Outdated
export type BucketObjectRevision = { | ||
id: string, | ||
version: number, | ||
data: {} | ||
}; |
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.
sidenote: I find this extremely helpful. the hardest part in reading through this code or in the Simperium server's code isn't know when a type is invalid, but knowing when a collection of properties is supposed to be a given type, or knowing what properties to supply when a hidden remote function expects certain ones.
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.
I hope with fully defined jsondiff
types this will shine a blazing light on all expected properties in the diffing/syncing magic.
src/simperium/channel.js
Outdated
var operation = { | ||
type Modify = 'M'; | ||
type Remove = '-'; | ||
type OperationType = Modify | Remove; |
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.
for funnies check out the utility types
const operations = {
Modify: 'M',
Remove: '-'
};
type Operation = $Values<typeof operations>;
something like that
The linter is complaining about a few things:
Looks like some class definitions need to be moved around and some spacing cleanup. |
I switched this to merge with |
For this:
When it's class definitions it shouldn't be a problem so we could |
WFM, but we'll need to add that 7 times in |
I had considered moving type definitions for the main components into it's own file which fixes this problem. I think the goal is to break this PR into smaller pieces too. |
#62 is the beginning of a smaller portion of this PR. |
Builds off of #56
internal
methods to usethis
context..bind