Skip to content

@findify/sdk: Typescript types largely unusable due to enum usage #809

@simonlovesyou

Description

@simonlovesyou

When using @findify/sdk (version 2.2.3) it is not possible to use the included typescript types since most "Request" definitions depend on enums which are not exported in the distributed code.

import type { Search } from '@findify/sdk/types/request'
import { init } from '@findify/sdk'

const client = init({ /* configuration */ })

const search = (query: Search.Params['q']) => {
  const request: Search.Request = {
    type: 'search', // Type '"search"' is not assignable to type 'Type.Search'.ts(2322)
    params: {
      q: query
    }
  }
  return client.send(request)
}

We cannot import Type and use as replacement for the search string since it's an enum. We need to either able to import a js file with a separate type declaration for the enum OR type is specified with a const string instead for the different requests

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