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;
    }
}
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1e9e23e-466f5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1e9e23e-466f5.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?