/
types.ts
64 lines (59 loc) · 1.84 KB
/
types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
import type {
StorybookConfig as StorybookConfigBase,
TypescriptOptions as TypescriptOptionsBase,
} from '@storybook/types';
import type { StorybookConfigVite, BuilderOptions } from '@storybook/builder-vite';
import type docgenTypescript from '@joshwooding/vite-plugin-react-docgen-typescript';
type FrameworkName = '@storybook/react-vite';
type BuilderName = '@storybook/builder-vite';
export type FrameworkOptions = {
builder?: BuilderOptions;
strictMode?: boolean;
/**
* Use React's legacy root API to mount components
* @description
* React has introduced a new root API with React 18.x to enable a whole set of new features (e.g. concurrent features)
* If this flag is true, the legacy Root API is used to mount components to make it easier to migrate step by step to React 18.
* @default false
*/
legacyRootApi?: boolean;
};
type StorybookConfigFramework = {
framework:
| FrameworkName
| {
name: FrameworkName;
options: FrameworkOptions;
};
core?: StorybookConfigBase['core'] & {
builder?:
| BuilderName
| {
name: BuilderName;
options: BuilderOptions;
};
};
};
type TypescriptOptions = TypescriptOptionsBase & {
/**
* Sets the type of Docgen when working with React and TypeScript
*
* @default `'react-docgen-typescript'`
*/
reactDocgen: 'react-docgen-typescript' | 'react-docgen' | false;
/**
* Configures `@joshwooding/vite-plugin-react-docgen-typescript`
*/
reactDocgenTypescriptOptions: Parameters<typeof docgenTypescript>[0];
};
/**
* The interface for Storybook configuration in `main.ts` files.
*/
export type StorybookConfig = Omit<
StorybookConfigBase,
keyof StorybookConfigVite | keyof StorybookConfigFramework
> &
StorybookConfigVite &
StorybookConfigFramework & {
typescript?: Partial<TypescriptOptions>;
};