// Type definitions for storybook-addon-jsx 5.4
// Project: https://github.com/storybooks/storybook
// Definitions by: James Newell <https://github.com/jameslnewell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8

import '@storybook/react';
import { ReactNode, ReactElement } from 'react';

type displayNameFunc<T> = (element: ReactElement<T>) => string;

declare module '@storybook/react' {
    interface Options {
        skip?: number;
        enableBeautify?: boolean;
        onBeforeRender?: (domString: string) => string;
        displayName?: string | displayNameFunc;
    }

    interface Story {
        addWithJSX(kind: string, fn: () => ReactNode, options?: Options): Story;
    }
}

// Type definitions for storybook-addon-jsx 5.4
// Project: https://github.com/storybooks/storybook
// Definitions by: James Newell <https://github.com/jameslnewell>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8

import '@storybook/react';
import { ReactNode, ReactElement } from 'react';

type displayNameFunc = (element: ReactElement<any>) => string;

declare module '@storybook/react' {
    interface Options {
        skip?: number;
        enableBeautify?: boolean;
        onBeforeRender?: (domString: string) => string;
        displayName?: string | displayNameFunc;
    }

    interface Story {
        addWithJSX(kind: string, fn: () => ReactNode, options?: Options): Story;
    }
}

Replace type for props with unknown
Replace type for props with unknown

Otherwise, you need to pass a type T to `Options` first in order to get that type in `displayNameFunc`, which is overkill.