An introduction to Typescript for programmers who use JavaScript.
It goes through what it is, what's it useful for, how to start using it and some things I've observed while using it.
Notes are not available but feel free to PM me if you have any question.
13. Compile time errors
Runtime errors ( traceur )
Better auto-completion
Helps the JS VM in making better code optimizations
Transpiles to ES3, ES5 or ES6
18. ES5 object literals support arbitrary expressions in
the value position.
ES6 classes only support literal functions as values.
Decorators restore the ability to run code at design
time, while maintaining a declarative syntax.
https://github.com/wycats/javascript-decorators
19. Typescript 1.4 is the current stable version.
The roadmap is planned until 2.0.
34. Libraries and frameworks are described with
interfaces.
Interfaces are defined in files with the .d.ts
extensions and are called ambient definitions.
A repository for TypeScript type definitions:
http://definitelytyped.org/
Check out https://www.npmjs.com/package/tsd
35. You usually create a folder in your project and
dump typings there for the libraries and
frameworks you use.
You need to reference the files in the source
code.
37. It's a common practice to create a reference file
where you add the paths for all the definitions
used in your project and just include that
everywhere.
42. It's a good idea to group things up into small
modules and wrap interfaces together with
classes / functions / etc. .
43. * you probably won't want to do that; it depends on the target of the
compiler and you'll loose the option of only compiling changes
A module can* be spread across multiple files.
53. Baked in:
Visual studio / Visual studio code
Plugins for:
Intellij IDEA
Sublime Text
Atom
Vim
Emacs
54. Plugins usually work as a client for TSServer
( an editor service bundled into TypeScript ).
It also outputs errors and warnings on save,
gaining you back some dev speed.
62. It's hard to add it slowly in your codebase.
It's easier to transition towards the web and
assume you don't need to learn JS.
Tsc can fail miserably at catching typing errors
when programming in a more functional style.
You will end up writing ambient definitions for
various – less popular – libraries.