Following the docs for testing-react with global config:
https://github.com/storybookjs/testing-react#global-config
import {setProjectAnnotations} from '@storybook/react';
import * as globalStorybookConfig from './.storybook/preview';
setProjectAnnotations(globalStorybookConfig);
I get the following TypeScript error:
setProjectAnnotations(globalStorybookConfig);
~~~~~~~~~~~~~~~~~~~~~
S2345: Argument of type 'typeof import("/Users/me/project/.storybook/preview")' is not assignable to parameter of type 'ProjectAnnotations | ProjectAnnotations []'.
This is my preview.ts file:
import type {Preview} from '@storybook/react';
const preview: Preview = {
// my config here
}
export default preview;
I checked the type of Preview and it's
type Preview = ProjectAnnotations<ReactRenderer>;
So clearly, it's the correct type.
How do I resolve this?