Closed empz closed 7 years ago
The problem is that the export needs to be outside the "declare module" and in order to declare a variable (Masonry
) we need to use the declare
keyword,
Here's the working typings.d.ts
file. I guess you can just replace the contents of it. I don't think forking your project and submitting a PR is worth the trouble.
Thank you
import { ComponentClass } from "react";
declare module "react-masonry-component" {
export interface MasonryOptions {
columnWidth?: number;
itemSelector?: string;
gutter?: number;
percentPosition?: boolean;
stamp?: string;
fitWidth?: boolean;
originLeft?: boolean;
originTop?: boolean;
containerStyle?: Object;
transitionDuration?: string;
resize?: boolean;
initLayout?: boolean;
}
interface MasonryPropTypes {
disableImagesLoaded?: boolean;
updateOnEachImageLoad?: boolean;
onImagesLoaded?: (instance: any) => void;
options?: MasonryOptions;
className?: string;
elementType?: string;
style?: Object;
}
}
declare const Masonry: ComponentClass<MasonryPropTypes>;
export default Masonry;
I have merged in #59 and will close this issue. Please reopen if needed
TypeScript 2.0.3 throws the following error on
typings.d.ts
I don't know why this is not allowed but I'll do some research on how to workaround this problem.