Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in typings: Exports and export assignments are not permitted in module augmentations. #57

Closed
empz opened this issue Nov 9, 2016 · 3 comments

Comments

@empz
Copy link

empz commented Nov 9, 2016

TypeScript 2.0.3 throws the following error on typings.d.ts

...\node_modules\react-masonry-component\typings.d.ts
(31,5): error TS2666: Exports and export assignments are not permitted in module augmentations.

I don't know why this is not allowed but I'll do some research on how to workaround this problem.

@empz
Copy link
Author

empz commented Nov 9, 2016

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;

@cwmoo740
Copy link
Contributor

#59

@afram
Copy link
Collaborator

afram commented Nov 22, 2016

I have merged in #59 and will close this issue. Please reopen if needed

@afram afram closed this as completed Nov 22, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants