diff --git a/addons/docs/src/frameworks/react/__testfixtures__/8143-ts-imported-types/docgen.snapshot b/addons/docs/src/frameworks/react/__testfixtures__/8143-ts-imported-types/docgen.snapshot new file mode 100644 index 000000000000..e07759d99ce9 --- /dev/null +++ b/addons/docs/src/frameworks/react/__testfixtures__/8143-ts-imported-types/docgen.snapshot @@ -0,0 +1,22 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`react component properties 8143-ts-imported-types 1`] = ` +"import React from 'react'; +export const FooComponent = foo => React.createElement(React.Fragment, null, JSON.stringify(foo)); +export const component = FooComponent; +FooComponent.__docgenInfo = { + \\"description\\": \\"\\", + \\"methods\\": [], + \\"displayName\\": \\"FooComponent\\", + \\"props\\": { + \\"bar\\": { + \\"required\\": true, + \\"tsType\\": { + \\"name\\": \\"Foo['bar']\\", + \\"raw\\": \\"Foo['bar']\\" + }, + \\"description\\": \\"\\" + } + } +};" +`; diff --git a/addons/docs/src/frameworks/react/__testfixtures__/8143-ts-imported-types/input.tsx b/addons/docs/src/frameworks/react/__testfixtures__/8143-ts-imported-types/input.tsx new file mode 100644 index 000000000000..7e30066389a2 --- /dev/null +++ b/addons/docs/src/frameworks/react/__testfixtures__/8143-ts-imported-types/input.tsx @@ -0,0 +1,10 @@ +import React from 'react'; +import { Foo } from './types'; + +interface FooProps { + bar: Foo['bar']; +} + +export const FooComponent = (foo: FooProps) => <>{JSON.stringify(foo)}; + +export const component = FooComponent; diff --git a/addons/docs/src/frameworks/react/__testfixtures__/8143-ts-imported-types/properties.snapshot b/addons/docs/src/frameworks/react/__testfixtures__/8143-ts-imported-types/properties.snapshot new file mode 100644 index 000000000000..704ca876098d --- /dev/null +++ b/addons/docs/src/frameworks/react/__testfixtures__/8143-ts-imported-types/properties.snapshot @@ -0,0 +1,21 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`react component properties 8143-ts-imported-types 1`] = ` +Object { + "rows": Array [ + Object { + "defaultValue": Object { + "detail": undefined, + "summary": "0", + }, + "description": "", + "name": "bar", + "required": true, + "type": Object { + "detail": undefined, + "summary": "Foo['bar']", + }, + }, + ], +} +`; diff --git a/addons/docs/src/frameworks/react/__testfixtures__/8143-ts-imported-types/types.ts b/addons/docs/src/frameworks/react/__testfixtures__/8143-ts-imported-types/types.ts new file mode 100644 index 000000000000..156212cf95ce --- /dev/null +++ b/addons/docs/src/frameworks/react/__testfixtures__/8143-ts-imported-types/types.ts @@ -0,0 +1,3 @@ +export interface Foo { + bar: number; +} diff --git a/addons/docs/src/frameworks/react/react-properties.stories.tsx b/addons/docs/src/frameworks/react/react-properties.stories.tsx index 625d0d5d5dc3..a6534783ceae 100644 --- a/addons/docs/src/frameworks/react/react-properties.stories.tsx +++ b/addons/docs/src/frameworks/react/react-properties.stories.tsx @@ -11,6 +11,7 @@ const fixtures = [ '9626-js-default-values', '9668-js-proptypes-no-jsdoc', '8143-ts-react-fc-generics', + '8143-ts-imported-types', ]; const stories = storiesOf('Properties/React', module);