Skip to content

Commit

Permalink
fix(deps): anonymous function for function argument
Browse files Browse the repository at this point in the history
fix #643
  • Loading branch information
vogloblinsky committed Sep 6, 2018
1 parent c650de6 commit c80504a
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/app/engines/html-engine-helpers/function-signature.helper.ts
Expand Up @@ -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 '';
}
}
}
});
Expand Down Expand Up @@ -95,7 +99,11 @@ export class FunctionSignatureHelper implements IHtmlEngineHelper {
arg
)}: <a href="${path}" target="_blank">${arg.type}</a>`;
} 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(', ');
Expand Down
5 changes: 5 additions & 0 deletions test/src/cli/cli-generation-big-app.spec.ts
Expand Up @@ -720,4 +720,9 @@ describe('CLI simple generation - big app', () => {
expect(file).to.contain('<span class="modifier">Abstract</span>');
expect(file).to.contain('<span class="modifier">Async</span>');
});

it('correct support function with empty typed arguments', () => {
let file = read(distFolder + '/components/AppComponent.html');
expect(file).to.contain('<code>openSomeDialog(model,');
});
});
2 changes: 2 additions & 0 deletions test/src/todomvc-ng2/src/app/app.component.ts
Expand Up @@ -16,4 +16,6 @@ export class AppComponent {
public getProperty<T, K extends keyof T>(obj: T, key: K) {
return obj[key];
}

public openSomeDialog(model, grid, callback: ({ index }) => {}): void {}
}

0 comments on commit c80504a

Please sign in to comment.