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
| Fact | Value |
|---|---|
| Issue type | private-type-leak |
| Rule id in SARIF output | fallow/private-type-leak |
| Command | fallow dead-code |
| Default severity | off |
Config key in rules | private-type-leaks |
| Filter option | --private-type-leaks |
| Suppression comment | // fallow-ignore-next-line private-type-leak |
Fixable with fallow fix | No |
| Opt-in | Yes |
Note. Opt-in API hygiene check; the rule defaults to off.
When to keep the code
- In an application, a private
Props,OptionsorStatetype 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 (
#fieldorprivate) 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
pageandlayoutfiles of the Next.js App Router.