-
Notifications
You must be signed in to change notification settings - Fork 258
Closed
Description
This example is based on the one in this project.
How to reproduce?
Add new file, FlippableImage.tsx:
import * as React from 'react';
export interface Props extends React.HTMLAttributes<HTMLImageElement> {
/** whether the image is flipped horizontally */
isFlippedX?: boolean;
/** whether the image is flipped vertically */
isFlippedY?: boolean;
}
/** An enhanced image component */
export const FlippableImage = (props: Props) => {
const {
src,
isFlippedX = false,
isFlippedY = false,
style,
...rest,
} = props;
let transform = '';
if (isFlippedX) {
transform += ` scale(-1, 1)`;
}
if (isFlippedY) {
transform += ` scale(1, -1)`;
}
return (
<img
src={src || undefined}
style={{ ...style, transform }}
{...rest}
/>
);
};
export default FlippableImage;This works as intended. However, when using type instead of interface, like this:
export type Props = React.HTMLAttributes<HTMLImageElement> & {
/** whether the image is flipped horizontally */
isFlippedX?: boolean;
/** whether the image is flipped vertically */
isFlippedY?: boolean;
}I get the following error:
Error in ./components/FlippableImage.tsx
Module build failed: TypeError: Cannot read property 'methods' of null
@ ./~/react-styleguidist/loaders/styleguide-loader.js!./~/react-styleguidist/lib/index.js 26:29-276
@ ./~/react-styleguidist/lib/index.js
@ multi ./~/react-styleguidist/lib/index ./~/react-dev-utils/webpackHotDevClient.js
Metadata
Metadata
Assignees
Labels
No labels