3

Is anyone frustrated with typescript or am I just doing it wrong? Like the types are never matched. Drill down the types in every prop. It just seems very extra.

Newbie in TS

Comments
  • 4
    Probably a little doing it wrong, and a little crossed circuits.

    It sounds like you're working against code that wasn't written in typescript and instead exposes a d.ts file. That can make a huge difference in whether TS is enjoyable or painful. Thanks to structural typing, TS will immediately expose ambiguity in standard js code, which can be frustrating as your your types will inevitably end up being any, unknown or X | Y | Z.
  • 0
    If you like TS depends on whether you like types or not.
    Generally you should play around a lot and try to understand that powerful type system. If used correctly, it saves tons of time debugging and developing.
    If used incorrectly, then it in stead is a pain to compile and doesn’t help at all.

    My tip is to go “strict” right from the beginning.

    Often you’ll think: I know what I’m doing: this can’t be null.
    Well turns out JS is a bitch and sometimes it is. Better check early and throw an error, so you know where to search the origin of a bug.
Add Comment