Expand TypeScript support
New Feature / Enhancement Checklist
- [x] I am not disclosing a vulnerability.
- [x] I am not just asking a question.
- [x] I have searched through existing issues.
Current Limitation
TypeScript support has been added with https://github.com/parse-community/Parse-SDK-JS/issues/1950. The next step is to expand it to more files.
Feature / Enhancement Description
Contributing
- Change file extension to
.ts - Remove @flow from file if it exists
- Add file to
./tsconfig.json -
npm run build:types - Fix types
- Add / enable tests in
types/test.ts -
npm run test:types - Compare types to @types/parse
Progress (1/62)
- [x] Analytics.js
- [x] AnonymousUtils.js
- [x] Cloud.js
- [x] CloudCode.js
- [x] CoreManager.js
- [x] CryptoController.js
- [x] EventEmitter.js
- [x] EventuallyQueue.js
- [x] FacebookUtils.js
- [x] IndexedDBStorageController.js
- [x] InstallationController.js
- [x] LiveQueryClient.js
- [x] LiveQuerySubscription.js
- [x] LocalDatastore.js
- [x] LocalDatastoreController.js
- [x] LocalDatastoreController.react-native.js
- [x] LocalDatastoreUtils.js
- [x] ObjectStateMutations.js
- [x] OfflineQuery.js
- [x] Parse.js
- [x] ParseACL.js
- [x] ParseCLP.js
- [x] ParseConfig.js
- [x] ParseError.js
- [x] ParseFile.js
- [x] ParseGeoPoint.js
- [x] ParseHooks.js
- [x] ParseInstallation.js
- [x] ParseLiveQuery.js
- [x] ParseObject.js
- [x] ParseOp.js
- [x] ParsePolygon.js
- [x] ParseQuery.js
- [x] ParseRelation.js
- [x] ParseRole.js
- [x] ParseSchema.js
- [x] ParseSession.ts
- [x] ParseUser.js
- [x] Push.js
- [x] RESTController.js
- [x] SingleInstanceStateController.js
- [x] Socket.weapp.js
- [x] Storage.js
- [x] StorageController.browser.js
- [x] StorageController.default.js
- [x] StorageController.react-native.js
- [x] StorageController.weapp.js
- [x] TaskQueue.js
- [x] UniqueInstanceStateController.js
- [x] Xhr.weapp.js
- [x] arrayContainsObject.js
- [x] canBeSerialized.js
- [x] decode.js
- [x] encode.js
- [x] equals.js
- [x] escape.js
- [x] isRevocableSession.js
- [x] parseDate.js
- [x] promiseUtils.js
- [x] unique.js
- [x] unsavedChildren.js
- [x] uuid.js
- [x] WebSocketController
Thanks for opening this issue!
- 🎉 We are excited about your ideas for improvement!
@mtrezza just realized I can’t edit the OP (original post). I would like to put my name down to claim some files in case @danielbm @sadortun or other developers want to work on them to prevent conflicts
I'd say just post a comment with the sub-list you're working on and I'll update the main list from time to time.
Alright, once the PRs are merged, I'll go ahead and cross the items off the list. Other than that, as always, a contributor is encouraged to read the thread to know whether someone is already working an the issue - or parts of it.
I also suggest to open a PR early while work is in progress, which allows others to have insight into the progress. To prevent blocking issues, as long as there is no PR (or the PR is stale) we would always welcome and suggest to others to start working on it if they asked.
quick question, is this npm package setup to allow using the typescript definitions defined in the parse.ts file? I'd like to remove @types/parse as it's outdated, but removing it causes typescript compile issues now.
Could not find a declaration file for module 'parse/node'. '.../node_modules/parse/node.js' implicitly has an 'any' type.
Try npm i --save-dev @types/parse if it exists or add a new declaration (.d.ts) file containing declare module 'parse/node';ts(7016)
Thanks for your help.
Hello I am not really sure this is entirely related but I open sourced my solution for providing types for custom database classes. What do you think about the approach? https://www.npmjs.com/package/parse-sdk-ts
@theolundqvist Your comment seems more related to https://github.com/parse-community/Parse-SDK-JS/issues/1313. You may want to move it to there, if it is of use to the discussion there. If you are just asking for feedback about your project however, as it seems from your comment, you would do that in the community forum - GitHub issues are not the right place for that.
@mtrezza I've been trying to tackle this here https://github.com/swittk/Parse-SDK-JS/tree/typescript What do you think? If this seems OK I plan to finish more of it soon.
There are a few places where I'm not sure though,
- ParseGeoPoint
static current()is supposed to return current GeoPoint, but it seems like the return result is wrapped in a callback - ParseObject has a couple of places where
this.constructoris used, and Typescript doesn't really like this pattern, so I had to castanyat those places. -
CoreManager.tshas a bunch of managers which appear to have either been defined with vague return values or incorrect function names, I've since corrected a few of them, but it's still not finished. Will look at the tests and DefaultManager implementation of each one to implement the correct types.
@swittk could you please open a PR for review?