TypeScript
Type annotations in TypeScript are lightweight ways to record the intended contract of the function or variable.
TypeScript can offer static analysis based on both the structure of your code, and the type annotations you provide.
Interfaces
Allows us to implement an interface just by having the shape the interface requires, without an explicit implements
clause.
Classes
Also of note, the use of public
on arguments to the constructor is a shorthand that allows us to automatically create properties with that name.
React & Webpack
That @types/
prefix means that we also want to get the declaration files for React and React-DOM. Usually when you import a path like "react"
, it will look inside of the react
package itself; however, not all packages include declaration files, so TypeScript also looks in the @types/react
package as well. You’ll see that we won’t even have to think about this later on.