dtsgenerator icon indicating copy to clipboard operation
dtsgenerator copied to clipboard

Interface PathParameters does not work with Express Request generic

Open svda opened this issue 4 years ago • 3 comments

Express allows you to extend the Request interface using generics, i.e. Request<Paths.CreateSubscription.PathParameters, {}, Paths.CreateSubscription.RequestBody>

The PathParameters interface this script currently generates does not play nicely with it however. You will get a typing error Index signature is missing in type 'PathParameters'.

This is solved if you change the interface the generator produces to a type instead since types infer the index signature: type PathParameters = {...}

svda avatar May 25 '20 10:05 svda

Perhaps the same problem as #406?

horiuchi avatar Jun 10 '20 07:06 horiuchi

I don't think that one is related no.

svda avatar Jul 23 '20 09:07 svda

@svda, can you provide a repeatable example of that problem?

      export interface PathParameters {
          name: string;
      }
      Request<Paths.OperationOne.PathParameters, {}, {}>

works great for me.

dtsgenerator: 3.7.0 @types/express: 4.17.11

npdev453 avatar Jan 24 '21 04:01 npdev453