Skip to content

Commit fd9648d

Browse files
authored
Merge pull request #55 from bertdeblock/remove-helper-wrapper
Remove `helper` wrapper from `helper` generator
2 parents e9d42ad + 0fcf153 commit fd9648d

File tree

3 files changed

+14
-64
lines changed

3 files changed

+14
-64
lines changed

templates/helper/function-based.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { helper } from "@ember/component/helper";
2-
3-
export default helper(function {{name.camel}}(positional, named) {
1+
export default function {{name.camel}}(positional, named) {
42
return positional;
5-
});
3+
}

templates/helper/function-based.ts

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,3 @@
1-
import { helper } from "@ember/component/helper";
2-
3-
type Named = {};
4-
type Positional = [];
5-
type Return = Positional;
6-
7-
export interface {{name.signature}} {
8-
Args: {
9-
Named: Named;
10-
Positional: Positional;
11-
};
12-
Return: Return;
13-
}
14-
15-
export default helper<{{name.signature}}>(function {{name.camel}}(positional, named) {
1+
export default function {{name.camel}}(positional, named) {
162
return positional;
17-
});
3+
}

test/__snapshots__/generate-helper.test.ts.snap

Lines changed: 10 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -35,70 +35,36 @@ export default class Foo extends Helper<FooSignature> {
3535
`;
3636
3737
exports[`generates a function-based \`.js\` helper 1`] = `
38-
"import { helper } from "@ember/component/helper";
39-
40-
export default helper(function foo(positional, named) {
38+
"export default function foo(positional, named) {
4139
return positional;
42-
});
40+
}
4341
"
4442
`;
4543
4644
exports[`generates a function-based \`.js\` helper at a custom path 1`] = `
47-
"import { helper } from "@ember/component/helper";
48-
49-
export default helper(function foo(positional, named) {
45+
"export default function foo(positional, named) {
5046
return positional;
51-
});
47+
}
5248
"
5349
`;
5450
5551
exports[`generates a function-based \`.ts\` helper 1`] = `
56-
"import { helper } from "@ember/component/helper";
57-
58-
type Named = {};
59-
type Positional = [];
60-
type Return = Positional;
61-
62-
export interface FooSignature {
63-
Args: {
64-
Named: Named;
65-
Positional: Positional;
66-
};
67-
Return: Return;
68-
}
69-
70-
export default helper<FooSignature>(function foo(positional, named) {
52+
"export default function foo(positional, named) {
7153
return positional;
72-
});
54+
}
7355
"
7456
`;
7557
7658
exports[`generates a function-based \`.ts\` helper at a custom path 1`] = `
77-
"import { helper } from "@ember/component/helper";
78-
79-
type Named = {};
80-
type Positional = [];
81-
type Return = Positional;
82-
83-
export interface FooSignature {
84-
Args: {
85-
Named: Named;
86-
Positional: Positional;
87-
};
88-
Return: Return;
89-
}
90-
91-
export default helper<FooSignature>(function foo(positional, named) {
59+
"export default function foo(positional, named) {
9260
return positional;
93-
});
61+
}
9462
"
9563
`;
9664
9765
exports[`generates a nested function-based \`.js\` helper 1`] = `
98-
"import { helper } from "@ember/component/helper";
99-
100-
export default helper(function fooBar(positional, named) {
66+
"export default function fooBar(positional, named) {
10167
return positional;
102-
});
68+
}
10369
"
10470
`;

0 commit comments

Comments
 (0)