types-and-interfaces
a shared type-level declaration living somewhere other than `common/types/`
Agent checkadvisory by defaultbasecode
The argument
Types and Interfaces → common/types/
The folder groups type-level declarations regardless of keyword. Pick the keyword by fit, not folder:
interfacefor object shapes (extends and merges cleanly)typefor what an interface can't express (unions, intersections, mapped types, primitives, tuples, function signatures)- Either works for an object shape → stay consistent within a domain. Refactoring between the keywords is an in-place edit; the filename and imports never change.
A discriminated union family lives in types/ under the union's name.
The Params interface stays with its function, and a type may stay with the single value typed by it (one-export-per-file's exception 5); every other exported type goes in types/:
// copyFile.ts — Params co-located, unexported
interface Params {
sourcePath: string;
destPath: string;
}
export const copyFile = ({ sourcePath, destPath }: Params) => { /* ... */ };
// common/types/CopyResult.ts — exported return type gets its own types/ file
export interface CopyResult {
success: boolean;
bytesWritten: number;
}
The proof
fail
import type { CopyResult } from '@/billing/CopyResult';
export const copyFile = (): CopyResult => ({ success: true });
pass
import type { CopyResult } from '@/common/types/CopyResult';
export const copyFile = (): CopyResult => ({ success: true });
Turn it down
Both lines go in your lightsout.config.json.
"standards-checks": { "types-and-interfaces": "advisory" }"standards-checks": { "types-and-interfaces": "off" }