New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Try react-docgen-typescript #12
Comments
I wanted to have a go at this and experimented a bit with Say I have props that look something like this interface Address {
street: string,
street2?: string,
pincode: number
}
interface Commit {
id: string,
message: string
}
interface Repo {
url: string,
demoSite?: string,
npm?: string,
commits: Array<Commit>
}
interface Person {
id: number,
name: string,
age: number,
address: Address,
family?: Array<number>,
repos: Array<Repo>
}
interface Props {
person: Person
} The information i get back from parsing the component is {
person: {
defaultValue: null,
description: '',
name: 'person',
parent: {
fileName: 'react-fake-props/fixtures/typescript/Component.tsx',
name: 'Props',
},
required: true,
type: {name: 'Person'},
},
} No reference to the |
Hi @alexdriaguine, Thanks a lot for giving it a try and sharing 👍. Tried too and got the same results. |
Closing this issue as react-docgen seems to be able to extract information from TypeScript now as well. |
See #18 |
Might also be worth looking at https://github.com/google/intermock |
Thanks @timini 👍 interesting, I din't know about this one. |
For typescript in the end I managed to generate a json schema from the interface using https://github.com/YousefED/typescript-json-schema then it is fairly simple to generate fake data from the json schema (ended up using json-schema-faker) if there was one package for this whole workflow it would make things a lot easier |
Currently only Flow and PropTypes are supported, but https://github.com/styleguidist/react-docgen-typescript (or other libs) may improve TypeScript support
The text was updated successfully, but these errors were encountered: