storybookjs / react-native

📓 Storybook for React Native!
https://storybook.js.org
MIT License
996 stars 141 forks source link

Export `DecoratorFunction` #506

Open hayata-suenaga opened 10 months ago

hayata-suenaga commented 10 months ago

Is your feature request related to a problem? Please describe. I want to use DecoratorFunction type. However, this type is not exported from the library.

Describe the solution you'd like import { DecoratorFunction } from @storybook/react-native

Describe alternatives you've considered

type Temp = Meta["decorators"];
type ExtractDecoratorFunction<T> = T extends (infer R)[] ? R : never;
type DecoratorFunction = ExtractDecoratorFunction<Temp>;

or

import {DecoratorFunction} from "@storybook/csf/dist/story"

Are you able to assist bring the feature to reality? maybe?

Additional context N/A

dannyhw commented 10 months ago

this should be possible, in the meantime heres a workaround you can use for now

import { addDecorator } from '@storybook/react-native';

type Decorator = Parameters<typeof addDecorator>[0];

You may also be able to use the decorator type from @storybook/react if you have it