Learning Rust by Contrasting with TypeScript: Part 1
Seeing Rust as a potential successor to TypeScript, we go through through the Rust Book with TypeScript in mind.

Motivation
Watch the video.
Prerequisites
The common requirement for both the Rust and TypeScript projects is the GIT version control system.
Rust Installation
Rust installation involves installing global binaries, e.g., rustc and cargo. This article was written using version 1.38.0.
TypeScript Installation
TypeScript depends on the JavaScript runtime Node.js; must first be installed. This installation involves installing global binaries, e.g., node and npm. This article was written using version 12.13.0.
TypeScript itself is installed as a Node.js project dependency as we will see below.
Rust Project Creation
Project setup involves running the cargo command to scaffold a Rust project:
note: The completed project is available for download.
cargo new r00_hello_world
The project is also initialized as a GIT repository with a .gitignore file. It also includes the sample source file: src/main.rs:
TypeScript Project Creation
Project setup first requires scaffolding a JavaScript Node.js project by creating a folder and using the npm command:
note: The completed project is available for download.
mkdir t00_hello_world
cd t00_hello_world
npm init --yes
We initialize the project as a GIT repository with:
git init
and create a .gitignore file:
We then convert the JavaScript Node.js project into TypeScript by first installing the TypeScript development dependency:
npm install -D typescript
We then create a TypeScript configuration file: tsconfig.json. Here we use the microsoft/TypeScript-Node-Starter example.
We update the .gitignore file to ignore the output directory: dist:
We update the package.json; updating the main value and adding a start and build to scripts:
Finally, we create the source file: src/index.ts:
Rust Build
During development, we use the following command to build a Rust project:
cargo build
The output is a compiled OS executable: target/debug/r00_hello_world.
For release, an optimized build, we use the following command:
cargo build --release
The output is a compiled OS executable: target/release/r00_hello_world.
TypeScript Build
We use the following command to build a TypeScript project:
npm run build
The output is a transpiled JavaScript file: dist/index.js.
Rust Execute
We simply execute the compiled OS executable as we would any other:
./target/debug/r00_hello_world
We can also use the command:
cargo run
to both build and run.
TypeScript Execute
We execute the transpiled JavaScript file using the npm script:
npm start
or we can execute it directly:
node dist/index.js
In either case, we are executing our project on top of the JavaScript runtime.
Next Steps
Now that we are done with the project mechanics for each of the languages, we will start to dive into the languages themselves in the next article: Learning Rust by Contrasting with TypeScript: Part 2.