RE: Getting started with Hive app development

avatar

You are viewing a single comment's thread:

If one chooses Javascript, I highly recommend to use Typescript.



0
0
0.000
3 comments
avatar

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?

0
0
0.000
avatar

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:
https://gist.github.com/quochuy/01d9e0f7cd56797b85e531ee984975ef

Would be come this in Typescript:
https://gist.github.com/quochuy/328a0e93005dabf0d015819bc9c13840


Or this in JS:
https://gist.github.com/quochuy/42c980e74e5c80a6a94548f282688560

Becomes this in TS:
https://gist.github.com/quochuy/5b95ba862fb6dc5d534b0c8a1c0658af

0
0
0.000
avatar

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.

0
0
0.000