Skip to content

[Bug]: typescript cannot compile since v5.11.1 #2006

Open
@DavideViolante

Description

@DavideViolante

MQTTjs Version

5.11.1 and above (also 5.13.1)

Broker

Aedes

Environment

NodeJS

Description

Simply upgrading from v5.11.0...v5.11.1 5.11.0 to 5.11.1 the build of my typescript project returns these errors:

> tsc

node_modules/mqtt/build/lib/client.d.ts:3:31 - error TS7016: Could not find a declaration file for module 'readable-stream'. '/home/dave/job/myproject/mqtt-broker/node_modules/mqtt/node_modules/readable-stream/lib/ours/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/readable-stream` if it exists or add a new declaration (.d.ts) file containing `declare module 'readable-stream';`

3 import { DuplexOptions } from 'readable-stream';
                                ~~~~~~~~~~~~~~~~~

node_modules/mqtt/build/lib/client.d.ts:5:31 - error TS7016: Could not find a declaration file for module 'ws'. '/home/dave/job/myproject/mqtt-broker/node_modules/ws/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/ws` if it exists or add a new declaration (.d.ts) file containing `declare module 'ws';`

5 import { ClientOptions } from 'ws';
                                ~~~~

node_modules/mqtt/build/lib/store.d.ts:1:26 - error TS7016: Could not find a declaration file for module 'readable-stream'. '/home/dave/job/myproject/mqtt-broker/node_modules/mqtt/node_modules/readable-stream/lib/ours/index.js' implicitly has an 'any' type.
  Try `npm i --save-dev @types/readable-stream` if it exists or add a new declaration (.d.ts) file containing `declare module 'readable-stream';`

1 import { Readable } from 'readable-stream';
                           ~~~~~~~~~~~~~~~~~

package.json

...
"dependencies": {
    "@influxdata/influxdb-client": "^1.35.0",
    "aedes": "^0.51.3",
    "async-mutex": "^0.5.0",
    "axios": "^1.9.0",
    "date-fns": "~3.6.0",
    "date-fns-tz": "~3.2.0",
    "firebase": "^11.10.0",
    "firebase-admin": "^13.4.0",
    "log4js": "^6.9.1",
    "mqtt": "^5.11.1",
    "node-cache": "^5.1.2",
    "redis": "^4.7.0"
  },
  "devDependencies": {
    "@commitlint/cli": "^19.8.1",
    "@commitlint/config-conventional": "^19.8.1",
    "@eslint/js": "^9.28.0",
    "@types/jest": "^29.5.14",
    "@types/node": "^22.15.29",
    "eslint": "^9.28.0",
    "husky": "^9.1.7",
    "jest": "^29.7.0",
    "ts-jest": "^29.3.4",
    "typescript": "^5.8.3",
    "typescript-eslint": "^8.35.1"
  }

Minimal Reproduction

cannot share job code, but no changes were made since last version. Let me know if you need more details specifically.
#2006 (comment)

Debug logs

error on compilation, no running. Found it via github action failing to build the project for the dependabot PR updating this lib.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions