Repository navigation
Type for Request object #1084
|
I have a case where i need to pass the ctx.request object to a function. But I am not able to find an exposed Request type/interface inside foalts. Request is defined in core/http/context.d.ts, but not exported. As an alternative I tried using Request interface from @types/express. But typescript is throwing incompatibility error. Can someone pls suggest me how to use type for Request object? |
Replies: 2 comments 2 replies
|
Hi @text2n 👋 Can it work if you define a type Request = Context['request'] |
|
@LoicPoullain The issue is when we have a function which accepts request as parameter. For example, the below hypothetical function accepts request object (req) as parameter. if we are using typescript, to define the type of "req" we need access to Request interface. I am sorry if i am missing something. I am bit new to typescript. |
Hi @text2n 👋
Can it work if you define a
Requesttype like this in your code?