mirror of
https://github.com/storybookjs/storybook.git
synced 2025-03-17 05:02:23 +08:00
Merge pull request #20166 from storybookjs/norbert/sb-919-sb19731-typescriptcheckoptions-has-been
Fix: typescript.checkOptions not a valid interface
This commit is contained in:
commit
0cb361fa16
@ -16,7 +16,7 @@ export interface TypescriptOptions extends TypeScriptOptionsBase {
|
|||||||
/**
|
/**
|
||||||
* Configures `fork-ts-checker-webpack-plugin`
|
* Configures `fork-ts-checker-webpack-plugin`
|
||||||
*/
|
*/
|
||||||
checkOptions?: ForkTsCheckerWebpackPlugin['options'];
|
checkOptions?: ConstructorParameters<typeof ForkTsCheckerWebpackPlugin>[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface StorybookConfigWebpack extends Pick<StorybookConfig, 'webpack' | 'webpackFinal'> {
|
export interface StorybookConfigWebpack extends Pick<StorybookConfig, 'webpack' | 'webpackFinal'> {
|
||||||
|
@ -63,7 +63,7 @@ export const link = async ({ target, local, start }: LinkOptions) => {
|
|||||||
`Magic stuff related to @storybook/preset-create-react-app, we need to fix peerDependencies`
|
`Magic stuff related to @storybook/preset-create-react-app, we need to fix peerDependencies`
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!reproPackageJson.devDependencies.vite) {
|
if (!reproPackageJson.devDependencies?.vite) {
|
||||||
await exec(`yarn add -D webpack-hot-middleware`, { cwd: reproDir });
|
await exec(`yarn add -D webpack-hot-middleware`, { cwd: reproDir });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,7 +341,7 @@ export interface StorybookConfig {
|
|||||||
/**
|
/**
|
||||||
* References external Storybooks
|
* References external Storybooks
|
||||||
*/
|
*/
|
||||||
refs?: CoreCommon_StorybookRefs | ((config: any, options: Options) => CoreCommon_StorybookRefs);
|
refs?: PresetValue<CoreCommon_StorybookRefs>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Modify or return babel config.
|
* Modify or return babel config.
|
||||||
@ -364,17 +364,17 @@ export interface StorybookConfig {
|
|||||||
*
|
*
|
||||||
* @deprecated use `previewAnnotations` or `/preview.js` file instead
|
* @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`
|
* 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.
|
* Process CSF files for the story index.
|
||||||
*/
|
*/
|
||||||
storyIndexers?: (indexers: StoryIndexer[], options: Options) => StoryIndexer[];
|
storyIndexers?: PresetValue<StoryIndexer[]>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Docs related features in index generation
|
* Docs related features in index generation
|
||||||
@ -386,11 +386,13 @@ export interface StorybookConfig {
|
|||||||
* The previewHead and previewBody functions accept a string,
|
* The previewHead and previewBody functions accept a string,
|
||||||
* which is the existing head/body, and return a modified 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> =
|
export type PresetProperty<K, TStorybookConfig = StorybookConfig> =
|
||||||
| TStorybookConfig[K extends keyof TStorybookConfig ? K : never]
|
| TStorybookConfig[K extends keyof TStorybookConfig ? K : never]
|
||||||
| PresetPropertyFn<K, TStorybookConfig>;
|
| PresetPropertyFn<K, TStorybookConfig>;
|
||||||
|
@ -143,7 +143,7 @@ function addEsbuildLoaderToStories(mainConfig: ConfigFile) {
|
|||||||
(config) => ({
|
(config) => ({
|
||||||
...config,
|
...config,
|
||||||
module: {
|
module: {
|
||||||
...config.modules,
|
...config.module,
|
||||||
rules: [
|
rules: [
|
||||||
// Ensure esbuild-loader applies to all files in ./template-stories
|
// Ensure esbuild-loader applies to all files in ./template-stories
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user