Skip to content

types: declare caller option on TransportBaseOptions - #2511

Open
lx3133584 wants to merge 1 commit into
pinojs:mainfrom
lx3133584:fix/types-transport-caller-option
Open

types: declare caller option on TransportBaseOptions#2511
lx3133584 wants to merge 1 commit into
pinojs:mainfrom
lx3133584:fix/types-transport-caller-option

Conversation

@lx3133584

Copy link
Copy Markdown

Problem

While caller is supported by pino.transport and documented in docs/api.md for framework integrations requiring custom caller resolution, passing caller to pino.transport(...) or pino({ transport: { caller: ... } }) resulted in a TypeScript compilation error because caller was omitted from TransportBaseOptions in pino.d.ts.

Cause

TransportBaseOptions declared options and worker properties, but did not declare caller?: string | string[], causing TypeScript to reject object literals containing caller due to excess property checks on TransportSingleOptions, TransportMultiOptions, and TransportPipelineOptions.

Fix

  • Added caller?: string | string[] to pino.TransportBaseOptions in pino.d.ts.

Testing

  • Added type assertions in test/types/pino-transport.tst.ts covering pino.transport with single and multiple targets as well as pino({ transport: { ... } }) with string and string array caller options.
  • Verified npm run test-types passes cleanly across all targets with attw verification.

Fixes pinojs#2476

Signed-off-by: Liang Xu <lx3133584@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant