I tried to give it a go, and it still feels a bit weird as compared to a native statically typed language(plus I can mix JS in between whenever I want?), any advice advice on how to make the typescript experience a bit better?
You will spend more time at the beginning but the learning curve is worth it.
Typescript + Eslint makes you a better developer I reckon. Forces you to code cleanly following standards so it's easier for someone else to join in later on or even for you to revisit old codes. As for Typescripts it will help reducing silly bugs such as passing the wrong parameter to a function or sending incomplete object to a method.
Everything becomes stricter, which can be annoying but in the long run you'll discover their usefulness.
Typescript is Javascript + types, so the code itself is Javascript and you have an additional syntax for declaring types. It's also recommended to add ESLint into the mix.
For example this JS code:
Would be come this in Typescript:
~~~ embed:328a0e93005dabf0d015819bc9c13840 gist metadata:cXVvY2h1eS8zMjhhMGU5MzAwNWRhYmYwZDAxNTgxOWJjOWMxMzg0MA== ~~~
Or this in JS:
Becomes this in TS:
~~~ embed:5b95ba862fb6dc5d534b0c8a1c0658af gist metadata:cXVvY2h1eS81Yjk1YmE4NjJmYjZkYzVkNTM0YjBjOGExYzA2NThhZg== ~~~
I tried to give it a go, and it still feels a bit weird as compared to a native statically typed language(plus I can mix JS in between whenever I want?), any advice advice on how to make the typescript experience a bit better?
You will spend more time at the beginning but the learning curve is worth it.
Typescript + Eslint makes you a better developer I reckon. Forces you to code cleanly following standards so it's easier for someone else to join in later on or even for you to revisit old codes. As for Typescripts it will help reducing silly bugs such as passing the wrong parameter to a function or sending incomplete object to a method.
Everything becomes stricter, which can be annoying but in the long run you'll discover their usefulness.
Typescript is Javascript + types, so the code itself is Javascript and you have an additional syntax for declaring types. It's also recommended to add ESLint into the mix.
For example this JS code:
Would be come this in Typescript:
~~~ embed:328a0e93005dabf0d015819bc9c13840 gist metadata:cXVvY2h1eS8zMjhhMGU5MzAwNWRhYmYwZDAxNTgxOWJjOWMxMzg0MA== ~~~
Or this in JS:
Becomes this in TS:
~~~ embed:5b95ba862fb6dc5d534b0c8a1c0658af gist metadata:cXVvY2h1eS81Yjk1YmE4NjJmYjZkYzVkNTM0YjBjOGExYzA2NThhZg== ~~~