-
Notifications
You must be signed in to change notification settings - Fork 83
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
Convert several modules to TypeScript #145
Conversation
This also (temporarily) replaces invocations of QueryMethod(...) with QueryMethod.default(...) in existing JS source so it can still be tested.
Fixes dojo#131 by making the default comparison function created in SimpleQuery#_createSortQuerier treat undefined as greater than any value, and null greater than any value besides undefined. This conveniently places all null and undefined values at the end of a sorted list.
Fixes dojo#124 by wrapping the return value from StoreAdapter's fetchRange function in a promise. This function is delegated to by fetch so this handles both cases. Also updated several test cases that were relying on the synchronous behavior of the StoreAdapter.
constructor(filterArg: string); | ||
constructor(filterArg: () => any); | ||
constructor(filterArg: FilterArgs); | ||
constructor(filterArg?: any) { |
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.
could you use a union type instead of the multiple constructor
declarations?
constructor(filterArg?: string | () => any | FilterArgs | any)
Additionally, not sure what our style guide says about this, but this definition will accept anything as a parameter. I can see the value of explicitly defining it this way for documentation purposes but we could just get away with
constructor(filterArgs?: any)
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 combined the constructor declarations using the union type, and realized that the any type wasn't actually needed.
store.remove(1); | ||
|
||
assert.deepEqual(methodCalls, ['put', 'add', 'remove']); | ||
assert.deepEqual.bind(this, events, ['update', 'add', 'delete']); |
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's the reason for this bind
call?
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.
No reason, and it was hiding the fact that this test was actually broken. I've removed the bind call and fixed the test.
The `package.json` now accuretly reflects the `LICENSE` that is included with the package.
6086bd9
to
b1e3995
Compare
Fixes dojo#143, Fixes dojo#138, Fixes dojo#137, Fixes dojo#136 * QueryResults has been converted to TypeScript * Filter has been converted to TypeScript * Store and tests/unit/Store have been converted. * Request and tests/unit/Request have been converted. All test cases that were previously passing are still passing, as well as the Request test cases. QueryResults needed to be modified to return an ES6 style promise, because of calls to super made by the promise returned from dojo-core/Request. This conversion in turn required many tests cases and some sources files to be updated, as they were relying on the fact that Dojo 1 style promises execute synchronously in some cases.
b1e3995
to
067d9bd
Compare
Given that we've moved the TS version of dstore to dojo/stores, I'm closing this out. |
Fixes #143, Fixes #138, Fixes #137, Fixes #136, Fixes #146
All test cases that were previously passing are still
passing, as well as the Request test cases.
QueryResults needed to be modified to return an ES6 style
promise, because of calls to super made by the promise
returned from dojo-core/Request. This conversion in turn
required many tests cases and some sources files to be
updated, as they were relying on the fact that Dojo 1 style
promises execute synchronously in some cases.