From c80504a5e1872dc74ca76abbd26cc47a5a9f0ebb Mon Sep 17 00:00:00 2001 From: Vincent Ogloblinsky Date: Thu, 6 Sep 2018 07:04:12 +0200 Subject: [PATCH] fix(deps): anonymous function for function argument fix #643 --- .../html-engine-helpers/function-signature.helper.ts | 12 ++++++++++-- test/src/cli/cli-generation-big-app.spec.ts | 5 +++++ test/src/todomvc-ng2/src/app/app.component.ts | 2 ++ 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/app/engines/html-engine-helpers/function-signature.helper.ts b/src/app/engines/html-engine-helpers/function-signature.helper.ts index 4dea7a25..eb986ebd 100644 --- a/src/app/engines/html-engine-helpers/function-signature.helper.ts +++ b/src/app/engines/html-engine-helpers/function-signature.helper.ts @@ -49,7 +49,11 @@ export class FunctionSignatureHelper implements IHtmlEngineHelper { if (argu.name && argu.type) { return `${argu.name}${this.getOptionalString(arg)}: ${argu.type}`; } else { - return `${argu.name.text}`; + if (argu.name) { + return `${argu.name.text}`; + } else { + return ''; + } } } }); @@ -95,7 +99,11 @@ export class FunctionSignatureHelper implements IHtmlEngineHelper { arg )}: ${arg.type}`; } else { - return `${arg.name}${this.getOptionalString(arg)}: ${arg.type}`; + if (arg.type) { + return `${arg.name}${this.getOptionalString(arg)}: ${arg.type}`; + } else { + return `${arg.name}${this.getOptionalString(arg)}`; + } } }) .join(', '); diff --git a/test/src/cli/cli-generation-big-app.spec.ts b/test/src/cli/cli-generation-big-app.spec.ts index e233c932..1d1048c2 100644 --- a/test/src/cli/cli-generation-big-app.spec.ts +++ b/test/src/cli/cli-generation-big-app.spec.ts @@ -720,4 +720,9 @@ describe('CLI simple generation - big app', () => { expect(file).to.contain('Abstract'); expect(file).to.contain('Async'); }); + + it('correct support function with empty typed arguments', () => { + let file = read(distFolder + '/components/AppComponent.html'); + expect(file).to.contain('openSomeDialog(model,'); + }); }); diff --git a/test/src/todomvc-ng2/src/app/app.component.ts b/test/src/todomvc-ng2/src/app/app.component.ts index 54b1564d..2b9e1880 100644 --- a/test/src/todomvc-ng2/src/app/app.component.ts +++ b/test/src/todomvc-ng2/src/app/app.component.ts @@ -16,4 +16,6 @@ export class AppComponent { public getProperty(obj: T, key: K) { return obj[key]; } + + public openSomeDialog(model, grid, callback: ({ index }) => {}): void {} }