Skip to content

Commit 389ea92

Browse files
committed
fix(@schematics/angular): improve pipe signature
Currently , the CLI generates : ```typescript transform(value: any , args?: any) ``` With this commit , it generate : ```typescript transform(value: any, ...args?: any[]) ``` Which conforms to the official doc Fixes angular#12602
1 parent 7e537c1 commit 389ea92

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

packages/schematics/angular/pipe/files/__name@dasherize@if-flat__/__name@dasherize__.pipe.ts.template

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { Pipe, PipeTransform } from '@angular/core';
55
})
66
export class <%= classify(name) %>Pipe implements PipeTransform {
77

8-
transform(value: any, args?: any): any {
8+
transform(value: any, ...args: any[]): any {
99
return null;
1010
}
1111

packages/schematics/angular/pipe/index_spec.ts

+2
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ describe('Pipe Schematic', () => {
5757
const moduleContent = getFileContent(tree, '/projects/bar/src/app/app.module.ts');
5858
expect(moduleContent).toMatch(/import.*Foo.*from '.\/foo.pipe'/);
5959
expect(moduleContent).toMatch(/declarations:\s*\[[^\]]+?,\r?\n\s+FooPipe\r?\n/m);
60+
const fileContent = tree.readContent('/projects/bar/src/app/foo.pipe.ts');
61+
expect(fileContent).toContain('transform(value: any, ...args: any[])');
6062
});
6163

6264
it('should import into a specified module', async () => {

0 commit comments

Comments
 (0)