diff --git a/addons/docs/src/frameworks/react/__testfixtures__/9922-ts-component-props/docgen.snapshot b/addons/docs/src/frameworks/react/__testfixtures__/9922-ts-component-props/docgen.snapshot new file mode 100644 index 000000000000..82025f6b33b3 --- /dev/null +++ b/addons/docs/src/frameworks/react/__testfixtures__/9922-ts-component-props/docgen.snapshot @@ -0,0 +1,38 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`react component properties 9922-ts-component-props 1`] = ` +"import React from 'react'; + +const Button = ({ + children, + onClick +}) => React.createElement(\\"button\\", { + onClick: onClick, + type: \\"button\\" +}, children); + +const WrappedButton = ({ + spacing, + ...buttonProps +}) => React.createElement(\\"div\\", { + style: { + padding: spacing + } +}, React.createElement(Button, buttonProps)); + +export const component = WrappedButton; +WrappedButton.__docgenInfo = { + \\"description\\": \\"\\", + \\"methods\\": [], + \\"displayName\\": \\"WrappedButton\\", + \\"props\\": { + \\"spacing\\": { + \\"required\\": true, + \\"tsType\\": { + \\"name\\": \\"number\\" + }, + \\"description\\": \\"\\" + } + } +};" +`; diff --git a/addons/docs/src/frameworks/react/__testfixtures__/9922-ts-component-props/input.tsx b/addons/docs/src/frameworks/react/__testfixtures__/9922-ts-component-props/input.tsx new file mode 100644 index 000000000000..797836d2c0d5 --- /dev/null +++ b/addons/docs/src/frameworks/react/__testfixtures__/9922-ts-component-props/input.tsx @@ -0,0 +1,23 @@ +import React, { FunctionComponent, ComponentProps, HTMLAttributes } from 'react'; + +type Props = Pick, 'onClick'>; +const Button: FunctionComponent = ({ children, onClick }) => ( + +); + +type WrappedProps = { + spacing: number; +} & ComponentProps; + +const WrappedButton: FunctionComponent = ({ + spacing, + ...buttonProps +}: WrappedProps) => ( +
+
+); + +export const component = WrappedButton; diff --git a/addons/docs/src/frameworks/react/__testfixtures__/9922-ts-component-props/properties.snapshot b/addons/docs/src/frameworks/react/__testfixtures__/9922-ts-component-props/properties.snapshot new file mode 100644 index 000000000000..f59e769ff676 --- /dev/null +++ b/addons/docs/src/frameworks/react/__testfixtures__/9922-ts-component-props/properties.snapshot @@ -0,0 +1,18 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`react component properties 9922-ts-component-props 1`] = ` +Object { + "rows": Array [ + Object { + "defaultValue": null, + "description": "", + "name": "spacing", + "required": true, + "type": Object { + "detail": undefined, + "summary": "number", + }, + }, + ], +} +`; diff --git a/addons/docs/src/frameworks/react/react-properties.stories.tsx b/addons/docs/src/frameworks/react/react-properties.stories.tsx index f94a4627c2a5..3ca5dc30c23f 100644 --- a/addons/docs/src/frameworks/react/react-properties.stories.tsx +++ b/addons/docs/src/frameworks/react/react-properties.stories.tsx @@ -28,6 +28,7 @@ const fixtures = [ '9465-ts-type-props', '8428-js-static-prop-types', '9764-ts-extend-props', + '9922-ts-component-props', ]; const stories = storiesOf('Properties/React', module);