The development environment now seems ready, so we can try it out with an elementary example:
let title: string = "RSS Aggregator";
We use the type annotation feature of TypeScript to set a constraint on the variable. That's so easy; we just extend the declaration with the so-called declaration space like :type, where type can be one of the basic types (boolean, number, string, array, void, any, and a few others), class, interface, type alias, enum, and import. Here, we applied string, meaning title accepts only strings.
After compiling with npm run build, we can find file example.js in the ./build directory with the following content:
let title = "RSS Aggregator";
You see it doesn't do much; it ...