Can anyone recommend a good introduction/book to TypeScript for people who already know some programming (e.g. Java, Python) but have no experience with JavaScript?

The only texts I’ve found so far assume prior JS knowledge (like The TypeScript Handbook https://www.typescriptlang.org/docs/handbook/intro.html) or seem rather unstructured to me (e.g. dropping a lot of different ways and shortcuts to do things without explaining concepts or making no clear distinction between basics/best practices and advanced use cases/edge cases).

Ideally it would explain core concepts (like functions, types, classes, …) first, with their most common use cases. Later chapter would do deep dives into different topics.

Edit: when I’m talking about TypeScript I’m talking about the whole language, not just the “modifications” it makes to JavaScript.

  • madkarlsson@beehaw.org
    link
    fedilink
    arrow-up
    1
    ·
    1 year ago

    Its important to understand that:

    • JavaScript is typescript
    • Typescript is JavaScript with types

    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

    const x: Record = {}
    

    In JS it would be

    const x = {}
    

    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.