Closed SamuelMarks closed 3 years ago
@kornelski Decided to do the crazy function
→class
conversion.
This is a massive change, not only in the code, but also in the way it's used.
It's nice to see the code mostly works fine with strict(er) types. However, it also has some quirky bits in the state machine that are taking advantage of class-less ad-hoc nature of JS, so some places got nicer, some got less nice.
There are some small wins in syntax, but many of them are also in ES6.
I like TS in general, but I'm not sure if it brings enough to this codebase to be worth the churn and addition of compilation step.
My reasoning for the rewrite was that all the frontend frameworks I use—e.g.: Angular—are developed in TypeScript. Sure, I could write a tiny .d.ts
for it, but I decided to go full throttle and rewrite.
Yeah, decided to use class
expressions for your quirky state machine.
You can also change the target in the tsconfig.json
to emit es6
.
As for the advantages of TypeScript, generally it is easier to maintain due to:
interface
s)(to name just a few… here's Ionic's list)
@kornelski Aww you closed this after 2.5 years
Still keen to get a TS rewrite of your library accepted…
Well, nothing has changed since. It's still a small library. Survived without types so far.
Nothing too crazy (like a
function
→class
conversion). Just annotated with types, replacedvar
withlet
/const
, moved to arrow functions, and switched to the new ES6export
syntax.BTW: With arrow functions I think we can remove all the
bind
s also.