-
Notifications
You must be signed in to change notification settings - Fork 15
Incorrect typings in @veriff/js-sdk force default import despite docs recommending named import #62
Description
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
-
Create a new TypeScript project.
-
Install the Veriff SDK via npm:
-
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;
}