flexsearch
flexsearch copied to clipboard
Error: export 'Document' (imported as 'Document') was not found in 'flexsearch' (possible exports: default)
When I’m using flexsearch in my project and the project uses typescript too. I wrote the code below, with no complaints from IDE:
import { Document } from 'flexsearch';
this.index = new Document<Document, true>({
document: {
id: 'id',
tag: 'type',
index: Array.from(indexes),
store: true
}
});
but when I compile the code I receive the following error:
Error: export 'Document' (imported as 'Document') was not found in 'flexsearch' (possible exports: default)
A similar error occurred also to this guy, where he explains the cause and how to resolve: Flexsearch Document Error
The solution works but with that all TypeScript types are broken, because replaced with any
I got the same error today.
The workaround from the link worked for me but I got the same error. Workaround:
import search from "flexsearch"
const i: search.Index = ...