How typescript merge declarations, non-merge functions

for example,

is declared in koa-bodyparser.
declare module "koa" {
    interface Request {
        body: {} | null | undefined;
        rawBody: {} | null | undefined;
    }
}

how can I add possible attributes to body? For example,

interface Imsg {
    msg: string
}

I also want to use the declaration file that he has already written. I just want to add a type. How can
Imsg be added to the type declaration of body, and how can I tell that the data received is of type Imsg?


add a more convenient and quick way to write .d.ts . Find a convenient place to copy and paste


d.ts

interface Imsg {
    msg: string
}

declare module "koa" {
    interface Request {
        body: {} | null | undefined | Imsg;
        rawBody: {} | null | undefined;
    }
}
Menu