mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-06-05 20:02:05 +08:00
Merge pull request #24130 from dawnmist/storybook-addons-action/fix-decorateAction-definition
[@storybook/addon-actions]: Fix faulty decorateAction definition.
This commit is contained in:
2
types/storybook__addon-actions/index.d.ts
vendored
2
types/storybook__addon-actions/index.d.ts
vendored
@@ -7,5 +7,5 @@
|
||||
export type HandlerFunction = (...args: any[]) => undefined;
|
||||
export type DecoratorFunction = (args: any[]) => any[];
|
||||
|
||||
export function decorateAction(decorators: DecoratorFunction[]): HandlerFunction;
|
||||
export function decorateAction(decorators: DecoratorFunction[]): (name: string) => HandlerFunction;
|
||||
export function action(name: string): HandlerFunction;
|
||||
|
||||
@@ -19,3 +19,21 @@ storiesOf('Button', module)
|
||||
Hello World!
|
||||
</button>
|
||||
));
|
||||
|
||||
interface CustomComponentProps {
|
||||
id: string;
|
||||
setValues(id: string, values: string[]): void;
|
||||
}
|
||||
class CustomComponent extends React.Component<CustomComponentProps> {
|
||||
setSomeValues = () => {
|
||||
this.props.setValues(this.props.id, ['one', 'two', 'three']);
|
||||
}
|
||||
render() {
|
||||
return <button onClick={this.setSomeValues}>Set some values</button>;
|
||||
}
|
||||
}
|
||||
|
||||
storiesOf('CustomComponent', module)
|
||||
.add('decorated custom action', () => (
|
||||
<CustomComponent id="test" setValues={firstArgAction('set-values')} />
|
||||
));
|
||||
|
||||
Reference in New Issue
Block a user