Closed joshmossas closed 2 years ago
@joshmossas Could you double check if the actual client
being passed into getDoc
is Typesense.Client
and not Typesense.SearchClient
? The latter only supports documents().search()
.
Yes sir, the client being passed into getDoc
is Typesense.Client
@jasonbosco I figured out the problem.
I was importing typesense like this:
import Typesense from 'typesense';
const client = new Typesense.Client({
// stuff here
})
But Typesense has no export default
so I needed to import it like so.
import * as Typesense from 'typesense';
const client = new Typesense.Client({
// stuff here
})
///// or alternatively /////
import { Client } from 'typesense';
const client = new Client({
// stuff here
});
Ah interesting! This was an unintentional change when we converted to Typescript. Will add a default export to prevent any confusion.
Pushed out v1.1.2
where you should now be able to do:
import Typesense from 'typesense'
or import { Client, SearchClient } from 'typesense'
orimport * as Typesense from 'typesense'
I tried
Pushed out
v1.1.2
where you should now be able to do:
import Typesense from 'typesense'
orimport { Client, SearchClient } from 'typesense'
orimport * as Typesense from 'typesense'
I tried all of these and I can't seem to get the import correct. Using rollup i always get this error:
Error: 'Typesense' is not exported by node_modules/typesense/lib/Typesense.js
Description
Calling
client.collections('some-collection').documents('some-doc-id').retrieve()
throws the following error:Steps to reproduce
Just call the method like specified in the Typesense docs. My code looks like the following:
Expected Behavior
This method should exist and should get the document associated with the documentId that was passed as outlined in the retrieve a document section of the docs
Actual Behavior
You get a "retrieve() is not a function" type error.
Metadata
OS: Windows 10