From 67403cebf29109e29acec7ff7b774b7e28484589 Mon Sep 17 00:00:00 2001 From: ncochard Date: Wed, 1 Aug 2018 19:35:36 +0100 Subject: [PATCH] The function withInfo in @storybook/addon-info should accept 0 or 1 argument (#27733) * The function withInfo in @storybook/addon-info should be able to accept no arguments. * The function withInfo in @storybook/addon-info should be able to accept no arguments. * The function withInfo in @storybook/addon-info should be able to accept no arguments. * Corrected the version number of @storybook/addon-info. This type definition was only tested with version 3.4.8 of @storybook/addon-info * Corrected the version number of @storybook/addon-info. This type definition was only tested with version 3.4.8 of @storybook/addon-info --- types/storybook__addon-info/index.d.ts | 4 ++-- types/storybook__addon-info/storybook__addon-info-tests.tsx | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/types/storybook__addon-info/index.d.ts b/types/storybook__addon-info/index.d.ts index c616933b8f..ebef2fed73 100644 --- a/types/storybook__addon-info/index.d.ts +++ b/types/storybook__addon-info/index.d.ts @@ -1,4 +1,4 @@ -// Type definitions for @storybook/addon-info 3.2 +// Type definitions for @storybook/addon-info 3.4 // Project: https://github.com/storybooks/storybook // Definitions by: Mark Kornblum // Mattias Wikstrom @@ -29,6 +29,6 @@ export interface Options { maxPropStringLength?: number; } -export function withInfo(textOrOptions: string | Options): (storyFn: RenderFunction) => (context?: object) => React.ReactElement; +export function withInfo(textOrOptions?: string | Options): (storyFn: RenderFunction) => (context?: object) => React.ReactElement; export function setDefaults(newDefaults: Options): Options; diff --git a/types/storybook__addon-info/storybook__addon-info-tests.tsx b/types/storybook__addon-info/storybook__addon-info-tests.tsx index b51a48c4cc..46fd799314 100644 --- a/types/storybook__addon-info/storybook__addon-info-tests.tsx +++ b/types/storybook__addon-info/storybook__addon-info-tests.tsx @@ -12,6 +12,11 @@ setDefaults({ }); storiesOf('Component', module) + .add('no info', + withInfo()(() => + Click the "?" mark at top-right to view the info. + ) + ) .add('simple info', withInfo('doc string about my component')(() => Click the "?" mark at top-right to view the info.