Generic Return Type, Optional Parameter and Default Value

In this lesson, you will cover the concept of the generic return type, optional parameter, and default value.

Function’s generic return type

TypeScript, since version 2.4, can infer the type of a function’s return value. Before version 2.4, s.length would give an error. The s was not from a U[] type but an empty object literal {}.

Get hands-on with 1200+ tech skills courses.