mirror of
https://github.com/swc-project/swc.git
synced 2024-12-24 06:05:02 +03:00
21 lines
346 B
TypeScript
21 lines
346 B
TypeScript
|
// basic uses of function literals with overloads
|
||
|
|
||
|
var f: {
|
||
|
(x: string): string;
|
||
|
(x: number): number;
|
||
|
} = (x) => x;
|
||
|
|
||
|
var f2: {
|
||
|
<T>(x: string): string;
|
||
|
<T>(x: number): number;
|
||
|
} = (x) => x;
|
||
|
|
||
|
var f3: {
|
||
|
<T>(x: T): string;
|
||
|
<T>(x: T): number;
|
||
|
} = (x) => x;
|
||
|
|
||
|
var f4: {
|
||
|
<T>(x: string): T;
|
||
|
<T>(x: number): T;
|
||
|
} = (x) => x;
|