express-request-id icon indicating copy to clipboard operation
express-request-id copied to clipboard

Fix TypeScript error caused by duplicate Request identifiers

Open devoto13 opened this issue 2 years ago • 3 comments

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

devoto13 avatar Nov 08 '22 14:11 devoto13

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

cpinkerton-kpler avatar May 05 '23 10:05 cpinkerton-kpler

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

devoto13 avatar May 05 '23 12:05 devoto13

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!

pgcalixto avatar Dec 13 '23 20:12 pgcalixto