Express and Typescript declaration files to extend Request object

preview_player
Показать описание
In this lesson we will learn how to use declaration files in Typescript to teach the typescript compiler about added data we are adding to Express Request object.
We will learn about declaration files.
We will use declaration files to extend the Express.Request object.
We will learn about DefinitelyTyped declaration files
We will examine popular examples where you will have to use declaration files to teach the typescript compiler.

The full source code of this lesson is available here:

#expressjs #typescript

0:00 Typescript is not aware of additional data on the request object
2:11 Lesson plan
4:27 Starting an Express with Typescript project
11:23 Piggy back on the Express Request object
14:50 Locale middleware
17:22 Declaration files
19:51 Creating a declaration file that extends Express.Request with locale data
25:03 Passport and creating declaration file for a module
32:30 DefinitelyTyped
37:35 Declaration file for overriding passport user on the Express.Request object
44:21 tsconfig options for telling typescript to consume your declaration files
50:04 Summary
Рекомендации по теме
Комментарии
Автор

Thanks for this video, it helped me use typescript with express properly.

abhisheksharma
Автор

This is masterpiece. Thank you for the lessons.

kingsleydaniel