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

Type definition #46

Open
albinmedoc opened this issue May 12, 2023 · 2 comments
Open

Type definition #46

albinmedoc opened this issue May 12, 2023 · 2 comments

Comments

@albinmedoc
Copy link

Would be lovely to use this with typescript.

@albinmedoc
Copy link
Author

I have figured out how to add a definition file myself.

import { fabric } from 'fabric';

declare module 'fabric/fabric-impl' {
    interface Canvas {
        /* fabric-history */
        undo: (callback?: () => void) => void;
        redo: (callback?: () => void) => void;
        clearHistory: () => void;
    }
}

@albinmedoc
Copy link
Author

It would be great to also add the event names to the fabric EventNames type. But I havn't figured it out.

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

1 participant