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

Convert several modules to TypeScript #145

Closed
wants to merge 16 commits into from

Conversation

maier49
Copy link
Contributor

@maier49 maier49 commented Jul 27, 2015

Fixes #143, Fixes #138, Fixes #137, Fixes #136, Fixes #146

  • 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.

Kenneth G. Franqueiro and others added 6 commits June 24, 2015 18:03
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) {
Copy link
Member

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)

Copy link
Contributor Author

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']);
Copy link
Member

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?

Copy link
Contributor Author

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.
@maier49 maier49 force-pushed the convert-request-to-ts branch from 6086bd9 to b1e3995 Compare September 4, 2015 22:01
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.
@maier49 maier49 force-pushed the convert-request-to-ts branch from b1e3995 to 067d9bd Compare September 11, 2015 15:19
@dylans
Copy link
Member

dylans commented May 24, 2017

Given that we've moved the TS version of dstore to dojo/stores, I'm closing this out.

@dylans dylans closed this May 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants