Skip to content

Incorrect typings in @veriff/js-sdk force default import despite docs recommending named import #62

@yimnai-dev

Description

@yimnai-dev

TypeScript Type Definitions Incorrectly Suggest Veriff Can Only Be Imported as Default Export

Description

The Veriff SDK documentation recommends importing the Veriff module as a named export, which aligns with best practices. However, the provided TypeScript type definitions incorrectly suggest that Veriff can only be imported as a default export, leading to TypeScript errors when following the documented approach.

Steps to Reproduce

  1. Create a new TypeScript project.

  2. Install the Veriff SDK via npm:

  3. Attempt to import Veriff as a named export in a TypeScript file, as recommended in the documentation, e.g.:

import { Veriff } from '@veriff/js-sdk';

Run the TypeScript compiler (tsc) or observe errors in your IDE.

Expected Behavior
The TypeScript compiler should recognize Veriff as a valid named export, allowing the import to work without errors, as per the documentation's recommendation.

Actual Behavior
TypeScript throws an error indicating that Veriff is not a named export, as the type definitions only expose it as a default export. For example:


# Work Around
declare module "@veriff/js-sdk" {
  interface VeriffInstance {
    mount: () => void;
  }

  interface VeriffConfig {
    apiKey: string;
    parentId: string;
    onSession: (err: Error | string | null, response: any) => void;
  }

  export function Veriff(config: Veriff): VeriffInstance;

  export default Veriff;
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions