Progress1 / 3
Question
What is the difference between calling and assigning a function in TypeScript?
Click or press Space to reveal
Answer
Calling a function: argument can be narrower, result can be widened.
Assigning a function: _parameter types go "the opposite way" (contravariance), return types go "the same way" (covariance).
type Entity = Deal | Lead
type Processor<Input extends Entity, Output extends Entity> = (input: Input) => Output;How well did you know this?