storybook-readme
storybook-readme copied to clipboard
Add typings for v5.0.0
Prev request typings request https://github.com/tuchk4/storybook-readme/issues/93 Prev DefinitelyTyped PR https://github.com/DefinitelyTyped/DefinitelyTyped/pull/29512
What new at 5.0.0
storybook-readme/index
- Added
addReadmedecorator that is result of makeDecorator(). According to storybooks code it should betype MakeDecoratorResult = (...args: any) => any; - Added
addHeader - Added
addFooter
addFooter and addHeader are the same
type addFooter =(md:string) => void;
type addHeader =(md:string) => void;
- Added
configureReadme
interface ICommonConfig {
header: string;
footer: string;
StoryPreview: React.ReactNode;
DocPreview: React.ReactNode;
HeaderPreview: React.ReactNode;
FooterPreview: React.ReactNode;
}
type ConfigureReadme = (config: ICommonConfig) => void;
storybook-readme/vue/index
- Added
addReadme - Added
addHeader - Added
addFooter - Added
configureReadme
cc @lonyele
wow you've been doing a lot of works 😀 I should check some differences before I make something useful. I'll watch this repo and hopefully can help make this repo better. good works!👍
@tuchk4 Hi, I've just pull requested v5 to DefinitelyTyped. Here is the link https://github.com/DefinitelyTyped/DefinitelyTyped/pull/34356
export type MakeDecoratorResult = (...args: any[]) => any;
export const addReadme: MakeDecoratorResult;
export function addFooter(md: string): void;
export function addHeader(md: string): void;
export interface ConfigureReadmeConfig {
header: string;
footer: string;
StoryPreview: (props: { children: React.ReactNode }) => React.ReactNode;
DocPreview: (props: { children: React.ReactNode }) => React.ReactNode;
HeaderPreview: (props: { children: React.ReactNode }) => React.ReactNode;
FooterPreview: (props: { children: React.ReactNode }) => React.ReactNode;
}
export function configureReadme(config: ConfigureReadmeConfig): void;
I looked up the actual code and changed some of it
-
addFooter, addHeader should be a function because It takes string and add it to config.js internally to be used later
-
inside of
interface ConfigureReadmeConfig, I changed StoryPreview, DocPreview, HeaderPreview, FooterPreview to a function as you wrote on https://github.com/tuchk4/storybook-readme#global-configuration -
same as
addFooter,addHeader, I changedConfigureReadmeto a function. (btw DefinitelyTyped lint doesn't allowIprefix on name so I changed it toConfigureReadmeConfig) -
since It is fully backward compatibility, I added new types for v5 and left all previous types with a comment
Please let me know if something is wrong (btw I'm really sorry for updating typescript definition this late)
@lonyele I just updated the types and I'm having issues with the ConfigureReadmeConfig interface.
I'm pretty sure those fields should all be optional since you are not required to provide all of them, in my code currently I only set StoryPreview and the other fields go with whatever default storybook-readme uses.
@taylon You are definitely right. I just made a PR. Usually It only takes 1~3 days untill it is merged. Thanks for making this better one
Or... it gets merged super fast.(https://github.com/DefinitelyTyped/DefinitelyTyped/pull/34417)