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

Add TypeScript declaration file #21

Closed
BlessMyCode opened this issue Jul 24, 2018 · 5 comments · Fixed by #42
Closed

Add TypeScript declaration file #21

BlessMyCode opened this issue Jul 24, 2018 · 5 comments · Fixed by #42
Labels
scope: types Related to type definitions

Comments

@BlessMyCode
Copy link

Can you add a typeScript declaration file in the project plz?
like this #5 but an updated version

@agilgur5
Copy link
Owner

I don't have experience with TypeScript, so I'm not confident in my ability to maintain a declaration file at this time. If there were a contributor who could maintain it, then I'd be okay with that, but otherwise I think a third-party typing makes more sense at this time.

As signature_pad recently did a re-write to TypeScript, I would like to do that at some point as well (and could potentially re-use signature_pad's types that way), but I don't have a timeline for that right now.

@chillitom
Copy link

chillitom commented Nov 5, 2018

I've submitted a PR with definitions.

In the meantime I've dropped a file in my source repo SignatureCanvas.d.ts with the following definition:

declare module 'react-signature-canvas' {
    // signature_pad's props
    export interface IOptions {
        dotSize?: number | (() => number);
        minWidth?: number;
        maxWidth?: number;
        minDistance?: number;
        backgroundColor?: string;
        penColor?: string;
        throttle?: number;
        velocityFilterWeight?: number;
        onBegin?: (event: MouseEvent | Touch) => void;
        onEnd?: (event: MouseEvent | Touch) => void;
    }

    // props specific to the React wrapper
    export interface SignatureCanvasProps extends IOptions {
        canvasProps?: any;
        clearOnResize?: boolean;
    }

    export default class SignatureCanvas extends React.Component<SignatureCanvasProps> {}
}

@ksocha
Copy link

ksocha commented Jan 4, 2020

I've created a PR to DefinitelyTyped as discussed in #25

DefinitelyTyped/DefinitelyTyped#41396

@agilgur5
Copy link
Owner

agilgur5 commented Jan 18, 2020

@types/react-signature-canvas is now published thanks to @ksocha !! 🎉 🎉 This also has more specific types than the ones here (further improved version of my improvements in #25), re-uses types from @types/signature_pad, and has tests.
Please file any type issues with those unofficial third-party type definitions at DefinitelyTyped.

Will be locking this now as a tracking issue. A TS re-write is in progress (#25 (comment)) so official internal TS support is planned for the v1.1.x release of react-signature-canvas, at which point @types/react-signature-canvas will no longer be necessary and will be deprecated.

Repository owner locked and limited conversation to collaborators Jan 18, 2020
@agilgur5 agilgur5 added the scope: types Related to type definitions label Jan 18, 2020
Repository owner unlocked this conversation Feb 7, 2020
@kmbro

This comment was marked as spam.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: types Related to type definitions
Projects
None yet
5 participants