Which language(s) do you think make the best introduction to static typing?
I think TypeScript is really a great choice for this.
It has smart inference, can be configured to be less strict and you can always opt-out with "any" in case you need to.
It has many features that reduce verbosity, like "typeof" or "infer" to derive types from existing code.
Take for instance this snippet from above, I'd shorten it to:
const five = 5 const banana = "banana" function add(n1: number, n2: number) { return n1 + n2 } add(five, banana)
Now it looks almost like plain JS and produces the same error.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
I think TypeScript is really a great choice for this.
It has smart inference, can be configured to be less strict and you can always opt-out with "any" in case you need to.
It has many features that reduce verbosity, like "typeof" or "infer" to derive types from existing code.
Take for instance this snippet from above, I'd shorten it to:
Now it looks almost like plain JS and produces the same error.