# `deslop/unused-type-declaration`

Disallow exported type declarations (interface / type-alias / enum-type) that are never referenced anywhere in the project.

- **Category:** Dead Code
- **Severity:** warn
- **Source:** deslop-js
- **Framework:** global
- **Enabled when:** react-doctor deadCode analysis enabled (default true); whole-project scan only — skipped in --diff/--staged modes
- **Documentation:** <https://github.com/millionco/deslop-js>

## Validation prompt

Use this to decide whether a fired diagnostic is real or a false positive.

Fires from deslop's detectUnusedTypes on a pure type-only export whose kind is interface, type-alias, or enum-type and which has zero meaningful references outside its own declaration site: reason reads 'type "X" has no references in the project' at high confidence, or 'type "X" is only re-exported through N barrel(s) and never used' at medium confidence when the only references are barrel export specifiers. False positive: the type is part of a published package's public API meant to be imported by downstream consumers outside the analyzed set, or it is referenced only via global/ambient augmentation or declaration merging the scan can't see — when confidence is medium (barrel-only re-export) lean SUPPRESS rather than delete an intentional public export.

## Fix prompt

Use this once validation confirms the diagnostic is real.

Delete the unused declaration outright (the whole `export interface X {...}` / `export type X = ...` / `export enum X {...}`), and remove any now-dead barrel re-export lines like `export type { X } from "./x"` that the trace lists as the only remaining references. If the type is genuinely public API for external consumers, deslop only stops flagging it when it lives behind a declared entry point — add the file to the analyzer's `entryPatterns` (or enable `includeEntryExports` to opt back in to strict checking), since entry-module type exports are excluded by default; a JSDoc tag like `@public` does nothing here. Carrying a type no module references just inflates the surface and confuses future readers. See https://github.com/millionco/deslop-js
