Skip to content

Improve Typescript Types #13

@MollardMichael

Description

@MollardMichael

Hello, you;ve recently added typescript support which is nice but the return type of most function is type as Record<string, unknown> | undefined

This gives almost no information to the user of the SDK.

A better approach would be to type the return of each function explicitly.

validateEmail(
    email: string,
    options?: ValidateEmailOptions | string | null
  ): Promise<EmailValidationResponse>;

type EmailValidationResponse = {
    ok: false;
    error: string;
} | {
   ok: true;
   response: {
     status: ValidationStatus
    sub_status: ValidationSubStatus
    ....
  }
}

this would help user to use the SDK without having to refer to the documentation to know which fields are available.

It would be appreciated, thanks

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