Skip to content

Commit

Permalink
simplify config types in experimental-nextjs-vite by reutilizing reac…
Browse files Browse the repository at this point in the history
…t-vite ones
  • Loading branch information
yannbf committed Dec 13, 2024
1 parent 9c4d4f0 commit bb323de
Showing 1 changed file with 6 additions and 28 deletions.
34 changes: 6 additions & 28 deletions code/frameworks/experimental-nextjs-vite/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import type {
CompatibleString,
StorybookConfig as StorybookConfigBase,
TypescriptOptions as TypescriptOptionsBase,
} from 'storybook/internal/types';
import type { CompatibleString } from 'storybook/internal/types';

import type { BuilderOptions, StorybookConfigVite } from '@storybook/builder-vite';

import type docgenTypescript from '@joshwooding/vite-plugin-react-docgen-typescript';
import type { BuilderOptions } from '@storybook/builder-vite';
import type { StorybookConfig as StorybookConfigReactVite } from '@storybook/react-vite';

type FrameworkName = CompatibleString<'@storybook/experimental-nextjs-vite'>;
type BuilderName = CompatibleString<'@storybook/builder-vite'>;
Expand All @@ -24,7 +19,7 @@ type StorybookConfigFramework = {
name: FrameworkName;
options: FrameworkOptions;
};
core?: StorybookConfigBase['core'] & {
core?: StorybookConfigReactVite['core'] & {
builder?:
| BuilderName
| {
Expand All @@ -34,23 +29,6 @@ type StorybookConfigFramework = {
};
};

type TypescriptOptions = TypescriptOptionsBase & {
/**
* Sets the type of Docgen when working with React and TypeScript
*
* @default `'react-docgen'`
*/
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 | 'typescript'
> &
StorybookConfigVite &
StorybookConfigFramework & {
typescript?: Partial<TypescriptOptions>;
};
export type StorybookConfig = Omit<StorybookConfigReactVite, keyof StorybookConfigFramework> &
StorybookConfigFramework;

0 comments on commit bb323de

Please sign in to comment.