Skip to content

Instantly share code, notes, and snippets.

@ncochard ncochard/readme.md
Last active Jul 31, 2018

Embed
What would you like to do?
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
You can’t perform that action at this time.