axa-group / Parsr

Transforms PDF, Documents and Images into Enriched Structured Data
Apache License 2.0
5.86k stars 311 forks source link

TypeScript Compilation Fails #673

Open pags opened 1 year ago

pags commented 1 year ago

Summary

TSError: ⨯ Unable to compile TypeScript:
server/bin/index.ts:81:49 - error TS2349: This expression is not callable.
  Type 'typeof import("Parsr/node_modules/file-type/index")' has no call signatures.

81   let fileType: { ext: string; mime: string } = filetype(fs.readFileSync(filePath));

Steps To Reproduce Steps to reproduce the behavior:

  1. npm i
  2. npm run run:debug -- --input-file samples/t1.pdf --output-folder dist/ --document-name example --config server/defaultConfig.json --pretty-logs

Environment

dieideeistgut commented 10 months ago

~~Hey @pags - did you ever find the fix for this? curious! ;) ~~ Edit: nevermind, figured it out. It's the file-type version.

tianli commented 10 months ago

Edit: nevermind, figured it out. It's the file-type version.

I had the same issue, could you share how to resolve it? Thx!

GilbertHLam commented 8 months ago

Downgrading the file-type package back down to 9.0.0 worked for me