Closed dhdaines closed 10 months ago
Note that the best workaround for the moment is to use the paths
option in tsconfig.json
to override the built-in types, as per https://stackoverflow.com/questions/41558661/ignore-bundled-d-ts-and-use-external-declarations (actually I am surprised this is not a more common situation with NPM modules given their highly variable code quality):
{
"compilerOptions": {
"baseUrl": ".",
"paths": {
"flexsearch": ["node_modules/@types/flexsearch"]
}
}
}
I'm using patches with patch-package. Not the best solution but it works.
The types in
index.d.ts
are quite incorrect, whereas the third-party ones in DefinitelyTyped (@types/flexsearch
) appear to be correct.Unfortunately TypeScript will prefer to use the ones in the package... the advice on the internet seems to be just to downgrade FlexSearch, presumably to a version where
index.d.ts
is correct. This seems like bad advice.Please fix the types or simply remove them so the library can be used from TypeScript.