Add semi for ts function declarations without body (#1911)

Fixes #1891
This commit is contained in:
Christopher Chedeau authored and GitHub committed 2017-06-02 14:49:37 -07:00
1 parent 6933d16125
commit e58dd2bf0b
4 files changed
+21 -1

No files matched your search

+3
View File
@@ -383,6 +383,9 @@ function genericPrintNoParens(path, options, print, args) {
parts.push("declare ");
}
parts.push(printFunctionDeclaration(path, print, options));
if (n.type === "TSNamespaceFunctionDeclaration" && !n.body) {
parts.push(semi);
}
return concat(parts);
case "ArrowFunctionExpression": {
if (n.async) {
@@ -772,7 +772,7 @@ namespace glo_M1_public {
}
declare module "glo_M2_public" {
export function f1()
export function f1();
export class c1 {}
export var v1: { new (): c1 };
export var v2: c1;
@@ -1,5 +1,18 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`semi.js 1`] = `
declare module 'foo' {
function foo(namespace: string): void;
function bar(namespace: string): void;
}
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
declare module "foo" {
function foo(namespace: string): void;
function bar(namespace: string): void;
}
`;
exports[`type_literal_optional_method.ts 1`] = `
var v: { e?(): number };
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+4
View File
@@ -0,0 +1,4 @@
declare module 'foo' {
function foo(namespace: string): void;
function bar(namespace: string): void;
}