mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2026-10-04 14:57:10 +00:00
@storybook/addon-notes: support global decorator
Support the global decorator usage supplied in [the README](https://github.com/storybooks/storybook/blob/9f30442098e5350f5ba4872887cf9d1a03146e74/addons/ondevice-notes/README.md#getting-started)
This commit is contained in:
+4
@@ -17,5 +17,9 @@ export type WithNotesOptions = string | {
|
||||
markdownOptions?: MarkedOptions;
|
||||
};
|
||||
|
||||
// It would be preferable to infer the argument types, but that requires TS v 3.1
|
||||
// export function withNotes(...args: StoryDecorator extends (...a: infer A) => any ? A : never): ReturnType<StoryDecorator>;
|
||||
export function withNotes(story: RenderFunction, context: { kind: string, story: string }): ReturnType<StoryDecorator>;
|
||||
// Less-preferred but still supported:
|
||||
export function withNotes(options?: WithNotesOptions): StoryDecorator;
|
||||
export function withMarkdownNotes(markdown: string, options?: MarkedOptions): StoryDecorator;
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
import * as React from 'react';
|
||||
|
||||
import { storiesOf } from '@storybook/react';
|
||||
import { addDecorator, storiesOf } from '@storybook/react';
|
||||
import { withNotes, withMarkdownNotes, } from '@storybook/addon-notes';
|
||||
|
||||
// New, preferred global registration:
|
||||
addDecorator(withNotes);
|
||||
|
||||
const SIMPLE_MARKDOWN = `
|
||||
## Markdown for component
|
||||
|
||||
|
||||
Reference in New Issue
Block a user