ravendb/ravendb-nodejs-client

Type clash with @types/node

Closed this issue · 2 comments

There seems to be a type clash with the newest minor version of @types/node (18.16.x).

Minimal example

package.json (pinned versions for definiteness):

{
  "dependencies": {
    "ravendb": "5.2.10"
  },
  "devDependencies": {
    "@types/node": "18.16.0",
    "typescript": "5.1.3"
  },
  "scripts": {
    "build": "tsc"
  }
}

tsconfig.json:

{
  "compilerOptions": {
    "target": "es2019",
    "module": "commonjs",
    "esModuleInterop": true,
    "moduleResolution": "node",
    "sourceMap": true,
    "outDir": "./dist",
    "noImplicitAny": true,
    "noFallthroughCasesInSwitch": true,
    "strictNullChecks": true,
    "alwaysStrict": true,
    "pretty": true,
  },
  "types": ["node"],
  "include": ["index.ts"],
  "exclude": ["node_modules", "dist"],
}

index.ts:

import { IDocumentStore } from "ravendb";

Expected behaviour

First, install the dependencies (npm i), then run npm run build. The project should build without problems.

Actual behaviour

We get the following error message:

node_modules/ravendb/dist/Documents/Session/DocumentResultStream.d.ts:11:18 - error TS2320: Interface 'DocumentResultStream<T>' cannot simultaneously extend types 'TypedEventEmitter<DocumentStreamResultEvents<T>>' and 'ReadableStream'.
  Named property 'listenerCount' of types 'TypedEventEmitter<DocumentStreamResultEvents<T>>' and 'ReadableStream' are not identical.

11 export interface DocumentResultStream<T extends object> extends TypedEventEmitter<DocumentStreamResultEvents<T>>, NodeJS.ReadableStream {
                    ~~~~~~~~~~~~~~~~~~~~


Found 1 error in node_modules/ravendb/dist/Documents/Session/DocumentResultStream.d.ts:11

The same problem does not arise with @types/node 18.15.x or lower.

Additional information

  • OS: Ubuntu 22.04
  • node version: 16.20.0
  • npm version: 9.7.1
ml054 commented

@jetzezoethout

Thanks for reporting this issue and perfect steps to reproduce. It helps a lot. :)

Here is ticket in our bugtracker: https://issues.hibernatingrhinos.com/issue/RDBC-732/Type-clash-with-types-node

ml054 commented

Fixed.