mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-17 05:02:23 +08:00
minor improvement in StorybookConfig type
This commit is contained in:
parent
d67e466939
commit
77f0d4fede
@ -341,7 +341,7 @@ export interface StorybookConfig {
|
||||
/**
|
||||
* References external Storybooks
|
||||
*/
|
||||
refs?: CoreCommon_StorybookRefs | ((config: any, options: Options) => CoreCommon_StorybookRefs);
|
||||
refs?: PresetValue<CoreCommon_StorybookRefs>;
|
||||
|
||||
/**
|
||||
* Modify or return babel config.
|
||||
@ -364,17 +364,17 @@ export interface StorybookConfig {
|
||||
*
|
||||
* @deprecated use `previewAnnotations` or `/preview.js` file instead
|
||||
*/
|
||||
config?: (entries: Entry[], options: Options) => Entry[];
|
||||
config?: PresetValue<Entry[]>;
|
||||
|
||||
/**
|
||||
* Add additional scripts to run in the preview a la `.storybook/preview.js`
|
||||
*/
|
||||
previewAnnotations?: (entries: Entry[], options: Options) => Entry[];
|
||||
previewAnnotations?: PresetValue<Entry[]>;
|
||||
|
||||
/**
|
||||
* Process CSF files for the story index.
|
||||
*/
|
||||
storyIndexers?: (indexers: StoryIndexer[], options: Options) => StoryIndexer[];
|
||||
storyIndexers?: PresetValue<StoryIndexer[]>;
|
||||
|
||||
/**
|
||||
* Docs related features in index generation
|
||||
@ -386,11 +386,13 @@ export interface StorybookConfig {
|
||||
* The previewHead and previewBody functions accept a string,
|
||||
* which is the existing head/body, and return a modified string.
|
||||
*/
|
||||
previewHead?: (head: string, options: Options) => string;
|
||||
previewHead?: PresetValue<string>;
|
||||
|
||||
previewBody?: (body: string, options: Options) => string;
|
||||
previewBody?: PresetValue<string>;
|
||||
}
|
||||
|
||||
export type PresetValue<T> = T | ((config: T, options: Options) => T | Promise<T>);
|
||||
|
||||
export type PresetProperty<K, TStorybookConfig = StorybookConfig> =
|
||||
| TStorybookConfig[K extends keyof TStorybookConfig ? K : never]
|
||||
| PresetPropertyFn<K, TStorybookConfig>;
|
||||
|
Loading…
x
Reference in New Issue
Block a user