jsforce
jsforce copied to clipboard
Discussion: Thoughts on converting library to Typescript
Hoping to start a dialog about taking this library and converting it to use Typescript instead of plain javascript. It would most likely shrink the codebase (since you'd have access to all the wonderful syntactic sugar that es6 provides,), it would make the library more maintainable, and having the power of types would allow us to catch a lot of potential errors before they happen.
I would be 100% willing to get the ball rolling by creating a Typescript branch and starting the conversion process, but I'd like to know how the rest of the community feels about it.
See also: https://github.com/jsforce/jsforce/issues/287
@loganvolkers good idea with lebab. I've never used that before. Still has a ways to go, but it's proving helpful
Comment as a code base author. I also sometime feel like to modernize the source code of JSforce which still remains as ES5 pure JS code, so the proposal is understandable. On the other hand, I'm afraid that possible contributers might not be in the edge and be lost when moved to different arch quickly. Additionally It is also to be considered the existing code has some parts of dynamic programming so moving to statically typed one will not be such straight-forward task. Finally, I personally use ES6+ (and sometime FlowType) in my other projects, not TypeScript, so if the modernization is required I might consider adopting ES6 first, which I think it might have broader cognition nowadays.
+1 Typescript
If anyone is interested I created definitions for the subset of the API that I needed to use. I don't have time to finish this right now but it could be used as the basis for a more complete implementation:
https://gist.github.com/cjdell/35c69fea2125cacfd5172f4e23de7b0e
@stomita after some time to think about it I think I agree with your sentiment on not using Typescript in particular. Maybe if we were to start transitioning to ES6/ES7 syntax instead, and then add definition files for Typescript as we go? I agree that some people may not be comfortable yet with the syntax, but this is a good learning opportunity and I feel like it's mostly necessary since JavaScript is evolving
-1 typescript.
Just found this library: https://github.com/Kegsay/flow-jsdoc
It converts JsDoc types into Flow type annotations.
I haven't tried it yet, but it sounds like it could help remove the legwork of the switch.
+1 to transition to ES6
This should be fixed in v3, see: https://github.com/jsforce/jsforce/discussions/1529