I'm using smart-knobs with TypeScript components using react-docgen-typescript-loader.
However I do not get any knobs on a component that just uses string union props like these. String props are fine so this is specific to the type handling.
export interface StatusIndicatorProps {
status: 'completed' | 'incomplete' | 'overdue';
}
const StatusIndicator: FC<StatusIndicatorProps> = props => {
// ...
}
The resulting __docgenInfo output by react-docgen-typescript-loader contains the following props:
props: {
status: {
defaultValue: null,
description: "",
name: "status",
required: true,
type: {name: '"completed" | "incomplete" | "overdue"'}
}
}
It would be nice if smart-props could support the string union types for at least simple unions that can properly be represented as a select or radio (e.g. a union of primitives like numbers, strings, undefined/null, and/or booleans).