TypeScript allows you to explicitly type the `this` context in functions by declaring it as a special first parameter. This prevents runtime bugs where `this` refers to an unexpected context. With strict mode enabled, TypeScript catches these mismatches at compile time. A practical example shows how typing `this: { base: number }` in a `pow` function ensures the correct property is accessed and triggers a build error if the calling object doesn't match the expected shape.

2m read timeFrom playfulprogramming.com
Post cover image

Sort: