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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Addon docs fails to render prop table correctly when type is imported from a .tsx file (.ts works as expected) #9591
Comments
ps - this is a contrived example, you might wonder why i dont just change |
What's your setup? Is this a webpack configuration issue? |
Hi @shilman this is my setup: This is a react setup (without CRA)
module.exports = {
stories: ['./Intro.stories.mdx', '../src/**/*.stories.tsx'],
addons: [
'@storybook/addon-knobs/register',
'storybook-addon-styled-component-theme/dist/register',
'@storybook/addon-actions/register',
'@storybook/addon-a11y/register',
{
name: '@storybook/preset-typescript',
options: {
tsLoaderOptions: {
transpileOnly: true,
configFile: 'tsconfig-sb.json',
},
},
},
{
name: '@storybook/addon-docs/react/preset',
},
],
} and my {
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"jsx": "react",
"noImplicitAny": true,
"noUnusedLocals": true,
"moduleResolution": "node",
"strict": true,
"noEmit": true,
"esModuleInterop": true
},
"include": ["src/**/*", "typings/**/*"],
"exclude": ["node_modules"]
}
|
One thing that might be worth noting is that all my storybook deps are updated to latest versions, apart from |
And I'm assuming that you've tried making both |
Not sure I follow? Examples 1 and 2 are identical apart from the file extension for |
Ah sorry, was looking at Examples 1 and 3 due to "scrolling error" on my laptop screen 馃槀 |
Repro: 82ee3a3 |
@sami616 can you try the recommended 6.0 setup (should work in 5.3 too): https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#react-prop-tables-with-typescript i don't expect it to fix the problem, but i believe this corresponds to reactjs/react-docgen#33 which has an open PR. upvoting on the issue/PR might help move things along |
@shilman i've updated all my deps, presumably i still need |
We've just released zero-config typescript support in 6.0-beta. Please upgrade and test it! Thanks for your help and support getting this stable for release! |
@shilman Have we got any progress on this issue? I have a similar issue, but it is not unique to Code Example /* ------------- types.ts ------------- */
export type SomeFn = () => number;
export interface AnObject {
isObject: boolean;
}
/* ------------- Component.tsx ------------- */
import { AnObject, SomeFn } from './types';
interface ComponentProps {
/**
* Annotation
*/
onMainInterface: boolean;
/**
* Annotation
*/
externalFn: SomeFn;
/**
* Annotation
*/
externalObj: AnObject;
}
const Component: FC<ComponentProps> = () => {
return <div>Hello mate</div>;
};
export default Component;
/* ------------- Component.stories.mdx ------------- */
import { Meta, ArgsTable } from '@storybook/addon-docs/blocks';
import Component from './Component'
<Meta title="Component" />
<ArgsTable of={Component} /> Package info
.storybook/main.js module.exports = {
stories: ['../src/**/*.stories.@(js|ts|md)x'],
typescript: {
reactDocgen: 'react-docgen-typescript',
},
addons: [
'@storybook/addon-docs',
// ... other addons
],
// ... other suff
}; While this is clearly acknowledged as a pitfall of using |
After some digging I found out what the issue was. I'm using a babel-plugin to generate |
Works 馃憤 (table shows both
other
andfoo
props)Doesnt work 馃憥馃徏 (table doesnt render at all)
Doesnt work 馃憥馃徏 (table renders, but shows
foo
as typeany
)The text was updated successfully, but these errors were encountered: