@types/storybook-addon-jsx
TypeScript icon, indicating that this package has built-in type declarations

7.0.7 • Public • Published

Installation

npm install --save @types/storybook-addon-jsx

Summary

This package contains type definitions for storybook-addon-jsx (https://github.com/storybookjs/addon-jsx).

Details

Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/storybook-addon-jsx.

index.d.ts

import { DecoratorFunction, Parameters, StoryApi } from "@storybook/addons";
import { ReactElement, ReactNode } from "react";

export type displayNameFunc = (element: ReactElement) => string;

export interface AddonParameters {
    skip?: number | undefined;
    enableBeautify?: boolean | undefined;
    onBeforeRender?: ((domString: string) => string) | undefined;
    displayName?: string | displayNameFunc | undefined;
}

export type AddWithJSXFunc<StoryFnReturnType> = (
    kind: string,
    fn: () => ReactNode,
    options?: AddonParameters,
) => StoryApi<StoryFnReturnType>;

declare module "@storybook/addons" {
    interface ClientStoryApi<StoryFnReturnType = unknown> {
        storiesOf(kind: string, module: NodeModule):
            & StoryApi<StoryFnReturnType>
            & { addWithJSX: AddWithJSXFunc<StoryFnReturnType> };
        addDecorator(decorator: DecoratorFunction<StoryFnReturnType>): StoryApi<StoryFnReturnType>;
        addParameters(parameter: Parameters & { jsx: AddonParameters }): StoryApi<StoryFnReturnType>;
    }
}

export const jsxDecorator: DecoratorFunction<ReactElement<unknown>>;

Additional Details

Credits

These definitions were written by James Newell.

Readme

Keywords

none

Package Sidebar

Install

npm i @types/storybook-addon-jsx

Weekly Downloads

1,451

Version

7.0.7

License

MIT

Unpacked Size

5.16 kB

Total Files

5

Last publish

Collaborators

  • types