Type inference in TypeScript is a feature where the compiler automatically determines the type of a variable, function, or expression without the need for explicit type annotations from the developer. This enhances productivity by reducing the amount of boilerplate code, while still maintaining the benefits of static typing
Default Parameters: When a default value is assigned to a parameter, TypeScript infers its type from that value.
Contextual Typing: TypeScript infers the types of variables based on their usage, such as in callbacks or event listener
Function Return Type: If a function returns a value, TypeScript infers the return type based on the function body.
Variable Inference: When you declare a variable and initialize it with a value, TypeScript infers the type from the assigned value.