Skip to content

no-broad-return-type

Report explicit broad return annotations that erase a known return value.

Why

An unknown, object, or unknown-valued dictionary return hides fields that the implementation already knows.

Fix

Return the existing domain type or retain the inferred return contract. Keep unknown at unparsed input boundaries.

Examples

Before — flagged Preserve the explicit contract
src/example.ts
type Invoice = { reference: string; total: number };
function toRequest(invoice: Invoice): Record<string, unknown> {
return invoice;
}
After — preferred Use the direct contract
src/example.ts
type Invoice = { reference: string; total: number };
function toRequest(invoice: Invoice): Invoice {
return invoice;
}