Back

Correct types for Context object in `node-appwrite` with typescript

  • 0
  • Functions
Sam K
15 Jan, 2024, 09:57

Hello folks,

I have a question regarding the Context type in the main function in index.ts. I have checked the node-appwrite sdk in index.d.ts and nothing there.

TypeScript
  req: any
  res: any
  log: (msg: any) => void
  error: (msg: any) => void
}

export default async ({ req, res, log, error }: Context) => {}
TL;DR
Hey developers! I'm trying to understand the `Context` type in the `node-appwrite` SDK with TypeScript. I checked the `index.d.ts` file but couldn't find any information on it. Here's the code: ```typescript type Context = { req: any res: any log: (msg: any) => void error: (msg: any) => void } export default async ({ req, res, log, error }: Context) => {} ``` Any ideas on how to properly define the types for the `req` and `res` objects? Solution: The
Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more