I have this error message when using Typescript with Fuse.js
TS2345: Argument of type '{ keys: string; }' is not assignable to parameter of type 'FuseOptions<{ 'ISBN': string; 'title': string; 'author': string; }>'. Types of property 'keys' are incompatible. Type 'string' is not assignable to type '("title" | "ISBN" | "author")[] | { name: "title" | "ISBN" | "author"; weight: number; }[]'.
Here is the code:
let books = [{
'ISBN': 'A',
'title': "Old Man's War",
'author': 'John Scalzi'
},
{
'ISBN': 'B',
'title': 'The Lock Artist',
'author': 'Steve Hamilton'
}
]
let options = {
keys: 'title'
}
let fuse = new Fuse(books, options)
let filterResult = fuse.search('old')
The error is when hovering over options in let fuse = new Fuse(books, options)