1. Introduction
The document’s PDF is |HERE|.
The document’s codes are |HERE|.
This document is a product of Anthropic’s IA Claude. Its purpose is to transpose the document: [Introduction au langage Python 3 et au framework web Flask par l’exemple ] in two ways:
- the Python 3 language is replaced by the TypeScript 6 language;
- the Flask web framework in Python is replaced by the NestJS web framework;
Claude from Anthropic did most of the work (90%):
- code generation. We started with the code already written for the course “Introduction to the ECMASCRIPT 6 Language Through Examples.” Then I asked Claude to expand the course scripts to include database management and then to build a web service using the NestJS framework;
- Generating the course in ODT format. Here, too, we started with the ODT from the course “Introduction to the ECMASCRIPT 6 Language Through Examples.” Then I asked Claude to include all the new scripts he had created and to add comments to them.
My work consisted of two things:
- testing the code;
- revising the ODT document. In particular, I added screenshots to help the reader;
Serge Tahé, September 2026
==
The ECMAScript language has evolved significantly since 2019: ECMAScript has gone through editions from 2020 to 2026, and a companion language, [TypeScript], has established itself as the safest way to write JavaScript on a large scale. This rewrite closely follows the structure and teaching approach of the original document “Introduction to the ECMASCRIPT 6 Language Through Examples”—a script, its code, its line-by-line explanation, and its execution—but:
- all scripts are now written in [TypeScript] rather than in pure JavaScript;
- the explanations cover not only the language’s syntax but also its data types and the differences from JavaScript;
- New chapters have been added to cover the new features introduced between 2020 and 2026: optional chaining, classes with private fields, top-level
await, Object.groupBy, Array.fromAsync, and the latest additions from ECMAScript 2026 (Math.sumPrecise, Iterator.concat, Error.isError...); - a chapter is devoted to [Temporal], the modern successor to the Date object;
- the VSCode runtime screenshots from the original document have been replaced with the actual, verified output of each script, using tsx on Node.js 26.
Like the original document, this one refers to a tax calculation server written in PHP 7 (see the course “Introduction to the PHP7 Language Through Examples”). The final chapters build, in TypeScript, a client for this server—first a console application, structured in layers using [UI, métier, dao], and then a client running in a browser using [webpack].
This document requires active reading: to understand a script, you must read its code, its comments, and the actual result of its execution.
1.1. Target Audience and Prerequisites
This document is intended for beginners in TypeScript who are already familiar with the basics of programming (variables, loops, functions, conditional structures) in another language. No prior knowledge of JavaScript or TypeScript is required.
1.2. Organization of the Example Project
All scripts presented in this document belong to a single VSCode project—the typescript-fondamentaux/ folder in the complete directory structure described below—organized into one folder per chapter (basics, arrays, objects, strings, regexp, functions, exceptions, modules, async, http, classes, new-features, ecmascript-2026, temporal, tax-client). Each script is a .ts file that can be run directly with the following command from the project root:
Starting with the chapters on databases and NestJS, this project is no longer limited to the folder mentioned above: it is now part of a single, broader directory structure that includes all the scripts presented in this document—TypeScript fundamentals, database access, NestJS mini-projects, and case studies. It is this complete directory structure that the reader downloads, and a single **npm install command, run from its root directory, installs everything at once, thanks to the [npm workspaces]**:
cours-typescript-nestjs-scripts/
├── package.json
├── README.md
├── typescript-fondamentaux/
│ ├── bases/ tableaux/ objets/ strings/ regexp/ fonctions/
│ ├── exceptions/ modules/ async/ http/ classes/
│ └── nouveautes/ ecmascript-2026/ temporal/ client impots/
├── typescript-bases-de-donnees/
│ ├── sql/
│ └── databases/ (mysql/ typeorm/ prisma/)
├── nestjs-cours/
│ ├── hello-nest/
│ ├── actions-reponse/
│ ├── actions-modele/
│ └── acces-donnees/ (pilote-natif/ typeorm/ prisma/)
└── nestjs-etude-de-cas/
├── src/ (actions/ config/ entities/ filters/ model/ responses/ session/ utilities/)
└── views/
The purpose of each of these folders:
- typescript-fundamentals/ — the scripts for the language chapters (the one described above: basics, arrays, objects, functions, classes, async, exceptions, modules, new features ECMAScript, [Temporal], followed by the tax calculation server client);
- typescript-databases/ — the three chapters on database access: the native MySQL2 driver, ORM, TypeORM, and ORM Prisma;
- nestjs-cours/ — the NestJS mini-projects from the chapters on the framework: hello-nest (first project), actions-response, actions-model, and the data-access snippets illustrating NestJS combined with the native driver, TypeORM, and Prisma;
- nestjs-case-study/ — the complete project from the “Case Study” chapter: the port to NestJS of the PHP tax calculation server.
The README.md file in the root directory follows this structure; as noted above, each subfolder also contains its own README.md file, with its specific execution instructions.