this post was submitted on 02 Oct 2023
10 points (100.0% liked)
Programming
13376 readers
1 users here now
All things programming and coding related. Subcommunity of Technology.
This community's icon was made by Aaron Schneider, under the CC-BY-NC-SA 4.0 license.
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
I know TS doesn't remove that much from JS, but I expect the typing, structuring etc. to prevent some behavior that can occur in JS - otherwise what would be the point of e.g. the typing system? So that are the parts I don't need to learn (at least not at first).
I think an important point for me is that I'd rather learn "from a TS perspective", that is starting with best practices and common use cases as they appear in a TS environment. Right now it sounds to me that the usual way would be to read some JS book, where I learn e.g. about functions or objects. And then I would read another book with all the modifications that TS makes to e.g. functions or objects.
Its important to understand that:
When you are writing typescript, you are writing JavaScript but have additional syntax to help support type safety and structure. If you are creating a function that does x, it should very much be the same in JS and TS, just in TS it has extra syntax
TS doesn't modify the way JS works, its one of the stated needs for the tooling.
In TS, for example, I can denote an object as
In JS it would be
It's still nothing but an object. TS doesn't change the functionality, it just adds typing and checks that you are using that object properly as static build step.
What's the point of type hinting in Python?