TypeScript/tests/cases/compiler/declFileTypeAnnotationStringLiteral.ts

13 lines
275 B
TypeScript

// @target: ES5
// @declaration: true
function foo(a: "hello"): number;
function foo(a: "name"): string;
function foo(a: string): string | number;
function foo(a: string): string | number {
if (a === "hello") {
return a.length;
}
return a;
}