Skip to content

Commit

Permalink
Improve modifier documents
Browse files Browse the repository at this point in the history
  • Loading branch information
bertdeblock committed Mar 20, 2024
1 parent 541c5ef commit 25603e0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 21 deletions.
20 changes: 10 additions & 10 deletions documents/modifier.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default class [[name]] extends Modifier {
[[name := camel(inputs.name)-]]
[[signature := (pascal(inputs.name) + "Signature")-]]

import { modifier, type NamedArgs, type PositionalArgs } from "ember-modifier";
import { modifier } from "ember-modifier";

export interface [[signature]] {
Args: {
Expand All @@ -54,22 +54,22 @@ export default modifier<[[signature]]>(function [[name]](element, positional, na
[[name := pascal(inputs.name)-]]
[[signature := (pascal(inputs.name) + "Signature")-]]

import Modifier, { type NamedArgs, type PositionalArgs } from "ember-modifier";
import Modifier from "ember-modifier";

type Named = {};
type Positional = [];
type Element = null;

export interface [[signature]] {
Args: {
Named: {};
Positional: [];
Named: Named;
Positional: Positional;
};
Element: null;
Element: Element;
}

export default class [[name]] extends Modifier<[[signature]]> {
modify(
element: [[signature]]["Element"],
positional: PositionalArgs<[[signature]]>,
named: NamedArgs<[[signature]]>,
) {}
modify(element: Element, positional: Positional, named: Named) {}
}

```
22 changes: 11 additions & 11 deletions test/__snapshots__/generate-modifier.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,22 @@ export default class Foo extends Modifier {
`;

exports[`generates a class-based \`.ts\` modifier 1`] = `
"import Modifier, { type NamedArgs, type PositionalArgs } from "ember-modifier";
"import Modifier from "ember-modifier";
type Named = {};
type Positional = [];
type Element = null;
export interface FooSignature {
Args: {
Named: {};
Positional: [];
Named: Named;
Positional: Positional;
};
Element: null;
Element: Element;
}
export default class Foo extends Modifier<FooSignature> {
modify(
element: FooSignature["Element"],
positional: PositionalArgs<FooSignature>,
named: NamedArgs<FooSignature>,
) {}
modify(element: Element, positional: Positional, named: Named) {}
}
"
`;
Expand All @@ -45,7 +45,7 @@ export default modifier(function foo(element, positional, named) {});
`;
exports[`generates a function-based \`.ts\` modifier 1`] = `
"import { modifier, type NamedArgs, type PositionalArgs } from "ember-modifier";
"import { modifier } from "ember-modifier";
export interface FooSignature {
Args: {
Expand All @@ -60,7 +60,7 @@ export default modifier<FooSignature>(function foo(element, positional, named) {
`;
exports[`generates a function-based \`.ts\` modifier at a custom path 1`] = `
"import { modifier, type NamedArgs, type PositionalArgs } from "ember-modifier";
"import { modifier } from "ember-modifier";
export interface FooSignature {
Args: {
Expand Down

0 comments on commit 25603e0

Please sign in to comment.