Skip to content
Discussion options

You must be logged in to vote

You won't get TypeScript suggestions for canvas and userEvent in your play function unless you do two things:

  1. Add import 'storybook/test'; somewhere in your project (just once, not in every file). This enables the correct types for those parameters and unlocks intellisense for Testing Library methods in the play function context.
    Details & explanation

  2. For best TypeScript inference with CSF Next, define your stories using the StoryObj<typeof meta> pattern, like this:

import type { Meta, StoryObj } from '@storybook/react'; // or your framework

const meta = {
  component: MyComponent,
} satisfies Meta<typeof MyComponent>;
export default meta;

type Story = StoryObj<typeof meta>;

export

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@meeshan-dev
Comment options

Answer selected by meeshan-dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant