Narrow inferred type when function has explicit return
问题 Look at the following code: type Shape = null | string | string[] | { [key: string]: string | string[] } interface ICfg<InShape extends Shape, OutShape extends Shape> { shapes?: readonly [InShape, OutShape] handle?(x: NonNullable<this["shapes"]>[0]): NonNullable<this["shapes"]>[1] } function apply<InShape extends Shape, OutShape extends Shape>(cfg: () => ICfg<InShape, OutShape>) { return cfg() } const shape = { type: "abc", date: "qwe", } var x = apply(() => ({ shapes: [shape, shape], handle: