# `deslop/duplicate-inline-type`

Disallow repeating the same inline object type literal; extract a named type or interface.

- **Category:** Architecture
- **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 when deslop's detectDuplicateInlineTypes finds the same inline object type literal (matching structuralHash, member count >= 3) at two or more distinct source locations, reporting 'inline object shape {preview} appears at N sites across M file(s) — extract a named type', where {preview} is a sorted keys-only token like '{ id, name, role }'; the literal may sit in any context such as function-parameter, function-return, variable-annotation, local-type-alias, class-property, or interface-property. False positive: the repeated shape is small or coincidental — e.g. a 3-key source literal such as { x: number; y: number; width: number } or a one-off { label: string; value: string } that two unrelated callers happen to share — where the fields carry no shared domain meaning and a named type would just add a layer of indirection without genuine reuse; confidence 'low' single-file matches (fewer than two distinct paths and member count under 5) are the usual suspects, so suppress when the duplication is incidental rather than a real shared contract.

## Fix prompt

Use this once validation confirms the diagnostic is real.

Lift the repeated inline literal into one named type or interface and reference it at every site: replace the duplicated `(arg: { id: string; name: string; role: Role }) => ...` annotations with `interface User { id: string; name: string; role: Role }` (or `type User = { ... }`) declared once and used as `(arg: User)`, so the shape has a single source of truth and edits propagate everywhere. Co-locate the named type with its primary owner and export it if more than one module consumes it. See https://www.typescriptlang.org/docs/handbook/2/everyday-types.html#type-aliases
