Quick Links in Docs:
typescript error:
cannot use namespace as type
: Click hereWay1 Custom Args type:
import { ComponentStory } from '@storybook/react';
type SwitchStory = ComponentStory<typeof Switch>;
const Template: SwitchStory = (args) => <Switch {...args} />;
export const Checked: SwitchStory = Template.bind({});
Checked.args = {
isChecked: false,
};
export const UnChecked: SwitchStory = Template.bind({});
Checked.args = {
isChecked: true,
};
Generic Args Type:
import { Story } from '@storybook/react';
const Template: Story = (args: any) => <Switch {...args} />;
export const Checked: Story = Template.bind({});
Checked.args = {
// Beware: props are not typeschecked here
isChecked: false,
};