Overloads

In order for the compiler to pick the correct type check, it follows a similar process to the underlying JavaScript. It looks at the overload list and, proceeding with the first overload, attempts to call the function with the provided parameters. If it finds a match, it picks this overload as the correct overload. For this reason, it's customary to order overloads from most specific to least specific.
Note that the function create( name: string | boolean ): boolean | string piece is not part of the overload list, so it only has two overloads.

Literal Types

 
badge