July 2017
Intermediate to advanced
300 pages
5h 43m
English
Yeah, TypeScript is, indeed, an impressive language when it comes to writing a new code. But what about existing none-TypeScript libraries? For example, we are going to use React and Redux modules. They are written in JavaScript, not in TypeScript. Luckily, mainstream libraries are already provided with TypeScript declaration files. We can install these files per module using npm:
npm i -D @types/react npm i -D @types/react-dom
Now, when we try something stupid with any of these modules, we get immediately notified about the problem:
import * as React from "react"; import * as ReactDOM from "react-dom"; ReactDOM.render( <div></div>, "root" );
On compiling or even while typing, you will get the error:
error TS2345: Argument ...
Read now
Unlock full access