react-docgen-typescript
react-docgen-typescript copied to clipboard
Extend interface with absolute import
When I'm trying to change the imports from relative paths to absolute paths I loose my extended types in styleguidist.
I'm trying check this with direct call of react-docgen-typescript
Example file
import { Display } from './mixins/display'
import { BaseProps } from './shared/interfaces'
export interface Props extends BaseProps, Display {
print?: boolean
}
export function PrintValues(props: Props) {
return null
}
Parse file
const docgen = require('react-docgen-typescript')
const options = {
savePropValueAsString: true,
}
const customParser = docgen.withDefaultConfig(options)
const docs = customParser.parse('./src/test.tsx')
Output with relative paths of interface
[
{
tags: {},
filePath: 'src/test.tsx',
description: '',
displayName: 'PrintValues',
methods: [],
props: {
print: [Object],
className: [Object],
style: [Object],
display: [Object]
}
}
]
Output with absolute paths(tsc work without any errors):
[
{
tags: {},
filePath: 'src/test.tsx',
description: '',
displayName: 'PrintValues',
methods: [],
props: { print: [Object] }
}
]