Skip to content

@salesforce/core type declaration references pino.pino.TransportSingleOptions, breaks builds with skipLibCheck: false (TS2694) #3618

Description

@stephen-carter-at-sf

Summary

@salesforce/core's published type declarations reference pino.TransportSingleOptions in a way that fails tsc when library checking is enabled (skipLibCheck: false). Consumers that lib-check are forced to enable skipLibCheck to build.

Error

node_modules/@salesforce/core/lib/logger/logger.d.ts(262,63): error TS2694: Namespace 'pino.pino' has no exported member 'TransportSingleOptions'.

Root cause

lib/logger/logger.d.ts does:

import { type Logger as PinoLogger, pino } from 'pino';
// ...
export declare const getWriteStream: (level?: string) => pino.TransportSingleOptions;

pino's pino.d.ts uses export = pino with an outer declare namespace pino (where TransportSingleOptions is declared) and also a nested namespace pino inside it. The named import binding { pino } resolves to the inner pino.pino namespace, which does not contain TransportSingleOptions — hence TS2694: Namespace 'pino.pino' has no exported member 'TransportSingleOptions'.

The fix is likely to reference the type off the default/export = binding rather than the named pino import, e.g. use the outer namespace type (import type pino from 'pino' / pino.TransportSingleOptions) or import TransportSingleOptions directly.

Version bisect

@salesforce/core logger.d.ts line 1 import References pino.TransportSingleOptions? lib-check
8.31.3 import { type Logger as PinoLogger } from 'pino'; No ✅ clean
8.32.6 import { type Logger as PinoLogger, pino } from 'pino'; Yes (line 262) ❌ TS2694
9.1.0 import { type Logger as PinoLogger, pino } from 'pino'; Yes (line 262) ❌ TS2694

The regression was introduced in the 8.32.x line and persists in 9.1.0. pino resolved version at repro: pino@9.14.0.

Reproduction

  1. npm i @salesforce/core@9.1.0
  2. In a tsconfig.json with skipLibCheck unset/false and moduleResolution: NodeNext, run tsc --noEmit.
  3. Observe the TS2694 error above (the only error; it originates entirely inside @salesforce/core's .d.ts).

Impact

Downstream TypeScript consumers of @salesforce/core that keep skipLibCheck: false (the stricter, recommended setting) cannot compile without enabling skipLibCheck, which then disables .d.ts checking for all dependencies. A correct type declaration here would let consumers keep strict library checks.

Environment

  • @salesforce/core: 9.1.0 (and 8.32.6)
  • pino: 9.14.0
  • typescript: 6.0.3 (also reproduces on 7.0.2)
  • moduleResolution: NodeNext

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIssue or pull request that identifies or fixes a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions