typescript.d.ts

Response in .d.ts file


I'm writing a .d.ts file for libnpmpublish (here on npm). One of the functions return a promise that resolves to a Response. However, throwing Response straight into the typedef file results in this error:

Cannot find name 'Response'. ts(2304)

I've no idea what to do from here. Is there a package I need to get for this?

Playground link: here (Buffer is covered with @types/node)


Solution

  • Turned out that I could import @types/node-fetch and use its Response class.