github.com
Narrow generic conditional and indexed access return types when checking return statements by gabritto · Pull Request #56941 · microsoft/TypeScript
Fixes #33912.
Fixes #33014.
Motivation
Sometimes we want to write functions whose return type is picked between different options, depending on the type of a parameter. For instance:
declare const ...