Closed sceee closed 3 years ago
Any updates here? :) Thanks for your support and work!
Here is a sample working with TS: https://codesandbox.io/s/flexsearch07x-typescript-example-rm6fb?file=/src/index.ts
@ts-thomas -- Hi, this issue shouldn't be closed. I have the same issue when using Document() not Index() as the sample @haysclark shared.
I am with 0.7.31 the latest version.
@aurostudio this worked for me:
import Flexsearch from "flexsearch";
// @ts-ignore
const index = Flexsearch.Index();
index.add(0, 'test');
const res = index.search("test");
console.log(res);
I am trying to test 0.7.0 in a typescript project but I cannot get it to work. I don't know if the types are completely out of sync in 0.7.0 but when trying to initialize a FlexSearch index in 0.7.0, its just an empty object:
This is my code:
The issue is that
FlexSearch
is just an empty object when looking at it in the debugger.When I downgrade to the regular
0.6.32
it's working with the above code. Was there any change in 0.7.0 how to instantiate the index that is out of sync with the typedefs?