Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails due to BullMq import errors #317

Closed
DaniSchenk opened this issue Nov 23, 2020 · 1 comment
Closed

Build fails due to BullMq import errors #317

DaniSchenk opened this issue Nov 23, 2020 · 1 comment

Comments

@DaniSchenk
Copy link

DaniSchenk commented Nov 23, 2020

Similar to #129 my tsc build fails with the following errors:

> tsc

node_modules/bullmq/src/classes/child-pool.ts:27:26 - error TS2349: This expression is not callable.
  Type '{ default: { (options?: Options): Promise<number>; makeRange(from: number, to: number): Iterable<number>; }; makeRange(from: number, to: number): Iterable<number>; }' has no call signatures.

27       const port = await getPort();
                            ~~~~~~~

  node_modules/bullmq/src/classes/child-pool.ts:4:1
    4 import * as getPort from 'get-port';
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.

node_modules/bullmq/src/classes/redis-connection.ts:69:26 - error TS2351: This expression is not constructable.
  Type '{ default: RedisStatic; Cluster: ClusterStatic; Command: typeof Command; }' has no construct signatures.

69       this._client = new IORedis(opts);
                            ~~~~~~~

  node_modules/bullmq/src/classes/redis-connection.ts:2:1
    2 import * as IORedis from 'ioredis';
      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Type originates at this import. A namespace-style import cannot be called or constructed, and will cause a failure at runtime. Consider using a default import or import require here instead.


Found 2 errors.

Version details:

bullmq: 1.10.0
typescript: 4.0.5
node: v14.15.1
npm: 6.14.8

tsconfig.json:

{
  "compilerOptions": {
    "module": "commonjs",
    "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,
    "target": "es6",
    "moduleResolution": "node",
    "sourceMap": true,
    "rootDir": "src",
    "outDir": "dist"
  }
}

How can I solve these build errors? Thx in advance

@DaniSchenk
Copy link
Author

Somehow a wrong import sneaked into my Code

// wrong
import {JobsOptions} from "bullmq/src/interfaces/index";
// working
import {JobsOptions} from "bullmq";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant