Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/body-parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ declare module 'koa' {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface Request {
body?: unknown;
rawBody: string;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): With exactOptionalPropertyTypes enabled, rawBody?: string allows the property to be omitted but does not allow callers to explicitly assign undefined; this contradicts the intended string | undefined contract and the runtime behavior.

Triggers: When a TypeScript consumer uses exactOptionalPropertyTypes and clears or forwards rawBody by assigning undefined.

Suggested fix: Declare the properties as rawBody: string | undefined if explicit undefined assignments are part of the supported contract.

rawBody?: string;
}
}

declare module 'http' {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
interface IncomingMessage {
body?: unknown;
rawBody: string;
rawBody?: string;
}
}
/**
Expand Down
Loading