For reasons beyond my control I'm trying to compile Typescript into "JScript" (~es5/IE8 JS) so that IIS/ASP Classic can evaluate it. It's sort of working via Babel + Rollup. One thing I'm stuck on is making Classic ASP's "Response" object accessible in typescript. I can't seem to overwrite the existing Response definition.
I thought something like this would work:
declare global {
interface Response {
write: (val: string) => void
}
}
function writeSomething() {
Response.write("foo")
}
I receive this error:
Property 'write' does not exist on type '{ new (body?: BodyInit, init?: ResponseInit): Response; prototype: Response; error(): Response; redirect(url: string | URL, status?: number): Response; }'.ts(2339)
The Response object looks like:
var Response: {
new (body?: BodyInit, init?: ResponseInit): Response;
prototype: Response;
error(): Response;
redirect(url: string | URL, status?: number): Response;
}
// This Fetch API interface represents the response to a request.