Closed gugahoi closed 10 months ago
A little late but maybe of help still:
import {Logger} from '@google-cloud/logging-bunyan/build/src/middleware/express';
declare global {
namespace Express {
export interface Request {
log: Logger;
}
}
}
This extends the request object of typescript globally.
Hi @gugahoi, yes you can extend the type definition yourself to use this middleware in typescript. At this moment, we don't export the extended Request type in this library.
Just wondering what the recommended way to use this package's middleware with typescript. Is there a type to use for the request so that the compiler can understand the
log
calls? Currently I get the following error:Do I need to extend the type definitions myself?