Installation
npm install --save @types/storybook__addon-info
Summary
This package contains type definitions for @storybook/addon-info (https://github.com/storybookjs/storybook).
Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/storybook__addon-info.
import { DecoratorFunction, Parameters, StoryApi, StoryFn } from "@storybook/addons";
import { StoryContext } from "@storybook/csf/dist/story";
import { ComponentType, ReactElement } from "react";
export interface WrapStoryProps {
storyFn?: StoryFn | undefined;
context?: object | undefined;
options?: object | undefined;
}
export interface TableComponentOptionProps {
propDefinitions: Array<{
property: string;
propType: object | string;
required: boolean;
description: string;
defaultValue: any;
}>;
}
export interface Options {
text?: string | undefined;
header?: boolean | undefined;
inline?: boolean | undefined;
source?: boolean | undefined;
propTables?: Array<ComponentType<any>> | false | undefined;
propTablesExclude?: Array<ComponentType<any>> | undefined;
styles?: object | undefined;
components?: {
[key: string]: ComponentType<any>;
} | undefined;
marksyConf?: object | undefined;
maxPropsIntoLine?: number | undefined;
maxPropObjectKeys?: number | undefined;
maxPropArrayLength?: number | undefined;
maxPropStringLength?: number | undefined;
TableComponent?: ComponentType<TableComponentOptionProps> | undefined;
excludedPropTypes?: string[] | undefined;
}
export function withInfo<A = unknown>(
story: StoryFn<A>,
context: StoryContext<{ component: any; storyResult: A }>,
): ReturnType<DecoratorFunction<A>>;
export function withInfo(
textOrOptions?: string | Options,
): (storyFn: StoryFn) => (context?: object) => ReactElement<WrapStoryProps>;
export function setDefaults(newDefaults: Options): Options;
declare module "@storybook/addons" {
interface ClientStoryApi<StoryFnReturnType = unknown> {
storiesOf(kind: string, module: NodeModule): StoryApi<StoryFnReturnType>;
addParameters(parameter: Parameters & { info: Options }): StoryApi<StoryFnReturnType>;
addDecorator(decorator: DecoratorFunction<StoryFnReturnType>): StoryApi<StoryFnReturnType>;
}
}
Additional Details
Credits
These definitions were written by Mark Kornblum, Mattias Wikstrom, and Kevin Lee.