sindresorhus/serialize-error

Type definitions not being imported

Closed this issue · 0 comments

farah commented

I'm getting the following type error when trying to use this package as:

import serializeError from "serialize-error";
const serializedError = serializeError(error);
This expression is not callable.
  Type 'typeof import("/Users/farah/{PATH}/node_modules/serialize-error/index")' has no call signatures.ts(2349)
Cannot invoke an expression whose type lacks a call signature. Type 'typeof "/Users/farah/{PATH}/node_modules/serialize-error/index"' has no compatible call signatures.ts(234

tsconfig.js

{
  "compilerOptions": {
    "target": "es2015",
    "declaration": true,
    "lib": ["esnext", "dom"],
    "baseUrl": "src",
    "allowJs": true,
    "rootDir": "src",
    "skipLibCheck": true,
    "importHelpers": true,
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "strict": false,
    "forceConsistentCasingInFileNames": true,
    "module": "esnext",
    "moduleResolution": "node",
    "resolveJsonModule": true,
    "isolatedModules": true,
    "noUnusedLocals": false,
    "noEmit": true,
    "jsx": "preserve"
  },
  "typeAcquisition": {
    "enable": true
  },
  "exclude": ["node_modules", "build", "scripts"],
  "include": ["src", "types"]
}

Have tried both v6 and v7.