@findify/sdk: Typescript types largely unusable due to enum usage
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
@simonlovesyou Hey, thanks for discovering this!
We've released new SDK version: @findify/[email protected] where you'll be able to import RequestType:
import { RequestType } from '@findify/sdk';
Can you pls check how it works for you?
Thanks for the fix @timaramazanov ! I can see in my editor that typescript is satisfied, the added docs looks great too! Unfortunately I can't run our application and test it because we're blocked from upgrading by #796 :/