Skip to content
Fallow home
All docs pages

Docs home

Private type leaks

What a private-type-leak finding of fallow dead-code means, why it matters and how to fix it.

What it reports

Exported signature references a private type.

Dead code explains how fallow finds it.

Why it matters

Exported values or types whose public TypeScript signature references a same-file type declaration that is not exported. Consumers cannot name that private type directly, so the backing type should be exported or removed from the public signature.

Example

export function makeUser(): InternalUser exposes InternalUser even though InternalUser is not exported.

Fix

Export the referenced type, change the public signature to an exported type, or keep the helper private.

Facts

FactValue
Issue typeprivate-type-leak
Rule id in SARIF outputfallow/private-type-leak
Commandfallow dead-code
Default severityoff
Config key in rulesprivate-type-leaks
Filter option--private-type-leaks
Suppression comment// fallow-ignore-next-line private-type-leak
Fixable with fallow fixNo
Opt-inYes

Note. Opt-in API hygiene check; the rule defaults to off.

When to keep the code

  • In an application, a private Props, Options or State type of an exported function is often intentional. Do not export such a type only to satisfy this rule. Turn the rule on for packages that publish TypeScript declarations.

Notes

  • A private member (#field or private) is not part of the public signature, so its type does not leak.
  • Fallow skips Storybook story files, and route files where the framework requires several exports in one file, for example the page and layout files of the Next.js App Router.