Skip to content

Commit

Permalink
Props: #8143 repro for imported types
Browse files Browse the repository at this point in the history
  • Loading branch information
shilman committed Feb 14, 2020
1 parent e3927d9 commit 4129773
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -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\\": \\"\\"
}
}
};"
`;
Original file line number Diff line number Diff line change
@@ -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;
Original file line number Diff line number Diff line change
@@ -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']",
},
},
],
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface Foo {
bar: number;
}
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 4129773

Please sign in to comment.