Я пытался увеличить ContextDelegatedResponse
из @types/koa
, но у меня возникла ошибка при попытке получить доступ к исходным свойствам ContextDelegatedResponse
.
Этого не произойдет, если я попытаюсь увеличить BaseResponse
nor Response
.
Вот ссылка codeandbox для демонстрационного кода.
Кто-нибудь знает причину?
import { Middleware } from "koa";
declare module "koa" {
/**
* This interface is the base interface, and with `declare` keyword
*/
interface ContextDelegatedResponse {
test: string;
}
/**
* This interface extends `ContextDelegatedResponse`
*/
// interface BaseResponse {
// test: string;
// }
/**
* This interface extends `BaseResponse`
*/
// interface Response {
// test: string;
// }
}
const newMiddleware: Middleware = (ctx, next) => {
const test = ctx.response.test;
// Property 'status' does not exist on type 'Response'.ts(2339)
const status = ctx.response.status;
return next();
};