Merge pull request #10101 from davidcsally/allow-undefined-knobs

Addon-knobs: Allow `text` and `number` to take undefined values
This commit is contained in:
Michael Shilman 2020-04-01 09:07:30 +08:00 committed by GitHub
commit c5bd44f1e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View File

@ -14,11 +14,8 @@ export interface NumberTypeKnobOptions {
step?: number; step?: number;
} }
export interface NumberTypeKnob export type NumberTypeKnob = KnobControlConfig<NumberTypeKnobValue> &
extends KnobControlConfig<NumberTypeKnobValue>, NumberTypeKnobOptions & { value?: NumberTypeKnobValue };
NumberTypeKnobOptions {
value: NumberTypeKnobValue;
}
interface NumberTypeProps extends KnobControlProps<NumberTypeKnobValue | null> { interface NumberTypeProps extends KnobControlProps<NumberTypeKnobValue | null> {
knob: NumberTypeKnob; knob: NumberTypeKnob;

View File

@ -5,7 +5,7 @@ import { Form } from '@storybook/components';
import { KnobControlConfig, KnobControlProps } from './types'; import { KnobControlConfig, KnobControlProps } from './types';
type TextTypeKnobValue = string; type TextTypeKnobValue = string;
export type TextTypeKnob = KnobControlConfig<TextTypeKnobValue>; export type TextTypeKnob = KnobControlConfig<TextTypeKnobValue> & { value?: TextTypeKnobValue };
type TextTypeProps = KnobControlProps<TextTypeKnobValue>; type TextTypeProps = KnobControlProps<TextTypeKnobValue>;
export default class TextType extends Component<TextTypeProps> { export default class TextType extends Component<TextTypeProps> {