Open DimaBur opened 5 years ago
Same, even with @storybook/typescript-preset.
Same here; even using babel-loader. Did anyone manage to make it work? Not using CRA here. Using latest React and Typscript.
Addon docs is working well with this webpack configuration if some need
module.exports = ({ config }) => {
config.module.rules.push({
test: /\.(ts|tsx)$/,
use: [
{
loader: 'babel-loader',
options: {
presets: [
'@babel/preset-env',
'@babel/preset-typescript',
'@babel/preset-react',
]
}
},
'react-docgen-typescript-loader'
]
});
config.module.rules.push({
test: /\.scss$/,
use: ['style-loader', 'css-loader', 'sass-loader'],
});
config.resolve.extensions.push('.ts', '.tsx');
return config;
};
I'm having the exact same problem. I'm using the latest versions of TS, Storybook (+ relevant plugins), React. I've tried with babel-loader, ts-loader, and awesome-typescript-loader. That was working before and was started in 5.1 if I'm not mistaken.
@gal1419 I also seen when you don't export component directly I say this error. Cau you try this:
import React from "react";
import './Button.scss';
interface FancyButtonProps {
/**
* onPress function handler
*/
click?: (event?: React.MouseEvent<HTMLButtonElement, MouseEvent>) => void;
/**
* Set disabled button
*/
disabled: boolean;
/**
* Text displayed in button
*/
text: string;
/**
* CSS properties to apply to button
*/
style?: React.CSSProperties;
}
/**
* The world's most beautiful button
*/
export const FancyButton = ({disabled = false, text = 'Click me', style, click}: FancyButtonProps) => (
<button disabled={disabled} style={style} className='fancy-button' onClick={click}>
{text}
</button>
);
export default FancyButton;
With config I mentionned previously
@gregoryBernard thanks for the info, however, we don't use default exports, so that is not an option for us.
I'm using react-docgen-typescript-loader with the following configurations. In Storybook props are shown only is there are propTypes defined, but in I do it on TypeScript as
interface Props {...}
in info is writtenNo propTypes defined!
. Have tried to use with ts-loader or awesome-typescript-loader nothing changes.@storybook/react": "^5.1.1
webpack.config.js
config.js