Notice in the previous functions that we type the parameters (id: number, userData: CreateUserData) and return types (: Promise<User>), but we don’t type the user variable since TypeScript can infer it from the function’s return type.

Throughout this course, we’ll type interface definitions and non-obvious function return types, but let TypeScript infer everything else. We’ll occasionally show typing options for educational purposes, then use the cleaner inference approach. This keeps code clean while maintaining type safety.

Tags: