Overloaded Functions

Overloaded Functions

Documentation

The getWidget function accepts a number and returns a Widget, or accepts a string and returns a Widget array.

Code

let x: Widget = getWidget(43);

let arr: Widget[] = getWidget("all of them");

Declaration

declare function getWidget(n: number): Widget;
declare function getWidget(s: string): Widget[];
doc_TypeScript
2016-10-04 19:25:29
Comments
Leave a Comment

Please login to continue.