Dan Vanderkam

Effective TypeScript

Notify me when the book’s added
To read this book, upload an EPUB or FB2 file to Bookmate. How do I upload a book?
  • DDaudalagidhas quoted6 months ago
    When you install TypeScript, you get two executables:
    tsc, the TypeScript compiler
    tsserver, the TypeScript standalone server
  • DDaudalagidhas quoted6 months ago
    For new projects, you should start with noImplicitAny on, so that you write the types as you write your code.
  • DDaudalagidhas quoted6 months ago
    Once you grow accustomed to all variables having types, TypeScript without noImplicitAny feels almost like a different language.
  • DDaudalagidhas quoted6 months ago
    TypeScript adds a type system that models JavaScript’s runtime behavior and tries to spot code which will throw exceptions at runtime. But you shouldn’t expect it to flag every exception. It is possible for code to pass the type checker but still throw at runtime.
  • DDaudalagidhas quoted6 months ago
    TypeScript is a superset of JavaScript. In other words, all JavaScript programs are already TypeScript programs. TypeScript has some syntax of its own, so TypeScript programs are not, in general, valid JavaScript programs.
  • DDaudalagidhas quoted6 months ago
    How does TypeScript decide when to model JavaScript’s runtime behavior and when to go beyond it? Ultimately this is a matter of taste. By adopting TypeScript you’re trusting the judgment of the team that builds it. If you enjoy adding null and 7 or [] and 12, or calling functions with superfluous arguments, then TypeScript might not be for you!
  • DDaudalagidhas quoted6 months ago
    This is because type annotations tell TypeScript what your intent is, and this lets it spot places where your code’s behavior does not match your intent.
  • DDaudalagidhas quoted6 months ago
    While TypeScript can catch errors even if you don’t provide type annotations, it’s able to do a much more thorough job if you do.
  • DDaudalagidhas quoted6 months ago
    One of the goals of TypeScript’s type system is to detect code that will throw an exception at runtime, without having to run your code.
  • DDaudalagidhas quoted6 months ago
    TypeScript is a superset of JavaScript in a syntactic sense: so long as your JavaScript program doesn’t have any syntax errors then it is also a TypeScript program.
fb2epub
Drag & drop your files (not more than 5 at once)