Skip to content

Instantly share code, notes, and snippets.

@ncochard
Last active July 31, 2018 18:47
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save ncochard/b91014c4d9b9392650431f5acd665976 to your computer and use it in GitHub Desktop.
The function withInfo in @storybook/addon-info should be able to accept no arguments.

The function withInfo(...) in @storybook/addon-info accepts 0 or 1 argument.

import * as React from 'react';
import { storiesOf } from '@storybook/react';
import { withInfo } from '@storybook/addon-info';

const { Component } = React;

storiesOf('Component', module)
  .add('no info',
       withInfo()(() =>
         <Component>Click the "?" mark at top-right to view the info.</Component>
       )
  );

The example above works well in JavaScript. But it does not compile in TypeScript: TS2554: Expected 1 arguments, but got 0..

So I would like to modify the definition of the function withInfo in storybook__addon-info from...

withInfo(textOrOptions: string | Options)

...to...

withInfo(textOrOptions?: string | Options)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment