callback-this-type

Installation
SKILL.md

Provide a Type for this in Callbacks if It's Part of Their API

Overview

When a library calls a user-provided callback with a specific this context, that context is part of the API. TypeScript allows you to type this as the first parameter of a function, even though it's not a real parameter. This documents and enforces the expected context.

When to Use This Skill

  • Callbacks use this
  • API provides this context
  • Typing event handlers
  • Library sets this in callbacks
  • Documenting callback context

The Iron Rule

Type this as the first parameter when it's part of your callback API. This documents the expected context and enables autocompletion.

Example

Installs
15
GitHub Stars
2
First Seen
Feb 3, 2026
callback-this-type — marius-townhouse/effective-typescript-skills