Learn how to write a command line utility of your own in pure modern TypeScript.
Lez write some code!
Open the following documentation pages in tabs in your browser:
- JavaScript Strings
- JavaScript Numbers
- JavaScript Indexes
- JavaScript Objects
- JavaScript Globals
- tsc Compiler
- eslint Docs
- A pleasant editor or IDE; I still use (the now very dead) atom as a lightweight general purpose text editor & Intellij PyCharm for writing code.
- node recent- v17.2 or latest
- git
Setup:
# clone this repo:
git clone https://github.com/jesssullivan/IntroTypeScript && cd IntroTypeScript
# install typescript, node & eslint parser:
npm install
## Setup your TS linter (only if you want to set up eslint yourself)
# npm init @eslint/config
# Lint your TS:
npx eslint src/playground.ts
# Transpile some TS:
npm run-script tsc src/playground.ts
# Run your program:
node pub/playground.js
To start, lets write a program that:
- prompts the user to type "Hello World"
- print some info about the response;
- what is the type of user data we can use?
- did the user type Hello World?
- how many characters were typed?
- how many more characters are needed to reach the number 42?
- print some info about the response;
Lesson artefacts to add later:
- Working with Webpack: bundling & tree shaking algorithms
- Build a useful application for the browser: write some programmatic css, understanding the DOM, preform API calls from a client
- Build a Chrome plugin
- Build a file conversion tool with both a CLI and a neat browser user interface
- Build a useful Flask + TypeScript application for mobile phones