flexsearch icon indicating copy to clipboard operation
flexsearch copied to clipboard

Error: export 'Document' (imported as 'Document') was not found in 'flexsearch' (possible exports: default)

Open mirkoacadevmy opened this issue 9 months ago • 2 comments

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

mirkoacadevmy avatar May 10 '24 09:05 mirkoacadevmy

I got the same error today.

luwes avatar Jun 28 '24 15:06 luwes

The workaround from the link worked for me but I got the same error. Workaround:

import search from "flexsearch"
const i: search.Index = ...

zero1zero avatar Jul 27 '24 01:07 zero1zero