Skip to content
This repository was archived by the owner on Jun 24, 2025. It is now read-only.

Conversation

devoto13
Copy link

@devoto13 devoto13 commented Nov 8, 2022

Only interface declarations can be merged and using type results in the below error.

node_modules/@types/express-serve-static-core/index.d.ts:19:19 - error TS2300: Duplicate identifier 'Request'.

19         interface Request {}
                     ~~~~~~~

  node_modules/express-request-id/types.d.ts:7:8
    7   type Request = {
             ~~~~~~~
    'Request' was also declared here.

node_modules/express-request-id/types.d.ts:7:8 - error TS2300: Duplicate identifier 'Request'.

7   type Request = {
         ~~~~~~~

  node_modules/@types/express-serve-static-core/index.d.ts:19:19
    19         interface Request {}
                         ~~~~~~~
    'Request' was also declared here.

See https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#differences-between-type-aliases-and-interfaces

Only `interface` declarations can be merged and using `type` results in the below error.

```
node_modules/@types/express-serve-static-core/index.d.ts:19:19 - error TS2300: Duplicate identifier 'Request'.

19         interface Request {}
                     ~~~~~~~

  node_modules/express-request-id/types.d.ts:7:8
    7   type Request = {
             ~~~~~~~
    'Request' was also declared here.

node_modules/express-request-id/types.d.ts:7:8 - error TS2300: Duplicate identifier 'Request'.

7   type Request = {
         ~~~~~~~

  node_modules/@types/express-serve-static-core/index.d.ts:19:19
    19         interface Request {}
                         ~~~~~~~
    'Request' was also declared here.
```

See https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#differences-between-type-aliases-and-interfaces
@cpinkerton-kpler
Copy link

Is there a work-around for this issue or is express-request-id currently not compatible with a TypeScript project?

@devoto13
Copy link
Author

devoto13 commented May 5, 2023

You can use old version, 1.x works IIRC.

@pgcalixto
Copy link

I had the same problem, glad to see that a PR is open to fix this.

Hey, @floatdrop, any idea about when this is gonna be merged? :) Thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants