mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
Add storybook/addon-info types (#20538)
* Add storybook__addon-info types for version 3.2 * Better return type * Remove unnecessary compiler option
This commit is contained in:
parent
7f298ec31e
commit
ff0a65d058
31
types/storybook__addon-info/index.d.ts
vendored
Normal file
31
types/storybook__addon-info/index.d.ts
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
// Type definitions for @storybook/addon-info 3.2
|
||||
// Project: https://github.com/storybooks/storybook
|
||||
// Definitions by: Mark Kornblum <https://github.com/mkornblum>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
// TypeScript Version: 2.4
|
||||
|
||||
import * as React from 'react';
|
||||
import { RenderFunction } from '@storybook/react';
|
||||
|
||||
export interface WrapStoryProps {
|
||||
storyFn?: RenderFunction;
|
||||
context?: object;
|
||||
options?: object;
|
||||
}
|
||||
|
||||
export interface Options {
|
||||
text?: string;
|
||||
header?: boolean;
|
||||
inline?: boolean;
|
||||
source?: boolean;
|
||||
propTables?: JSX.Element[];
|
||||
propTablesExclude?: JSX.Element[];
|
||||
styles?: object;
|
||||
marksyConf?: object;
|
||||
maxPropsIntoLine?: number;
|
||||
maxPropObjectKeys?: number;
|
||||
maxPropArrayLength?: number;
|
||||
maxPropStringLength?: number;
|
||||
}
|
||||
|
||||
export function withInfo(textOrOptions: string | Options): (storyFn: RenderFunction) => () => React.ReactElement<WrapStoryProps>;
|
||||
30
types/storybook__addon-info/storybook__addon-info-tests.tsx
Normal file
30
types/storybook__addon-info/storybook__addon-info-tests.tsx
Normal file
@ -0,0 +1,30 @@
|
||||
/// <reference types="storybook__react" />
|
||||
|
||||
import * as React from 'react';
|
||||
import { storiesOf } from '@storybook/react';
|
||||
import { withInfo } from '@storybook/addon-info';
|
||||
|
||||
const { Component } = React;
|
||||
|
||||
storiesOf('Component', module)
|
||||
.add('simple info',
|
||||
withInfo('doc string about my component')(() =>
|
||||
<Component>Click the "?" mark at top-right to view the info.</Component>
|
||||
)
|
||||
)
|
||||
.add('using an options object',
|
||||
withInfo({
|
||||
text: 'String or React Element with docs about my component',
|
||||
inline: true,
|
||||
header: true,
|
||||
source: true,
|
||||
styles: {},
|
||||
marksyConf: {},
|
||||
maxPropObjectKeys: 1,
|
||||
maxPropArrayLength: 2,
|
||||
maxPropsIntoLine: 3,
|
||||
maxPropStringLength: 4,
|
||||
})(() =>
|
||||
<Component>Click the "?" mark at top-right to view the info.</Component>
|
||||
)
|
||||
);
|
||||
32
types/storybook__addon-info/tsconfig.json
Normal file
32
types/storybook__addon-info/tsconfig.json
Normal file
@ -0,0 +1,32 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"lib": [
|
||||
"es6"
|
||||
],
|
||||
"noImplicitAny": true,
|
||||
"noImplicitThis": true,
|
||||
"strictNullChecks": true,
|
||||
"strictFunctionTypes": true,
|
||||
"baseUrl": "../",
|
||||
"jsx": "react",
|
||||
"typeRoots": [
|
||||
"../"
|
||||
],
|
||||
"paths": {
|
||||
"@storybook/addon-info": [
|
||||
"storybook__addon-info"
|
||||
],
|
||||
"@storybook/react": [
|
||||
"storybook__react"
|
||||
]
|
||||
},
|
||||
"types": [],
|
||||
"noEmit": true,
|
||||
"forceConsistentCasingInFileNames": true
|
||||
},
|
||||
"files": [
|
||||
"index.d.ts",
|
||||
"storybook__addon-info-tests.tsx"
|
||||
]
|
||||
}
|
||||
1
types/storybook__addon-info/tslint.json
Normal file
1
types/storybook__addon-info/tslint.json
Normal file
@ -0,0 +1 @@
|
||||
{ "extends": "dtslint/dt.json" }
|
||||
Loading…
Reference in New Issue
Block a user