flexsearch icon indicating copy to clipboard operation
flexsearch copied to clipboard

get property missing from types

Open jonasbetareader opened this issue 3 years ago • 0 comments

I get the Property 'get' does not exist on type typescript error when trying to use documentIndex.get()

Sample code:

import { Document } from 'flexsearch';

type TestDocument = {
  id: number;
  foo: number;
  bar: string;
}

const docIndex = new Document<TestDocument>({});

docIndex.add({ id: 1, foo: 2, bar: 'test-document' });

docIndex.get(1); <--- Property 'get' does not exist on type 'Document<TestDocument, false>'.

Using "flexsearch: "^0.7.21", and "@types/flexsearch": "^0.7.3".

jonasbetareader avatar Jun 09 '22 07:06 jonasbetareader