Skip to content

has anyone managed to get this working with TypeScript? #5

@sheam

Description

@sheam

I tried creating a declaration file index.d.ts:

declare module 'react-signature-canvas'
{
    import * as React from 'react';
    
    interface ISignatureCanvasProps
    {
        velocityFilterWeight?: number;
        minWidth?: number;
        maxWidth?: number;
        dotSize?: number;
        penColor?: string;
        backgroundColor?: string;
        onEnd?: () => void;
        onBegin?: () => void;
        canvasProps?: any;
    }
    
    export class SignatureCanvas extends React.Component<ISignatureCanvasProps, any>
    {
        constructor(p: ISignatureCanvasProps, s: any);
    }
    
    namespace SignatureCanvas {}
}

And then importing via: import * as SignatureCanvas from 'react-signature-canvas';.

But when I use the <SignatureCanvas /> in my react component I get
React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object

Any ideas?

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: featureNew feature or requestkind: supportAsking for support with something or a specific use casescope: integrationRelated to an integration, not necessarily to core (but could influence core)scope: typesRelated to type definitions

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions