Problem
KarpeSlop does not currently report unsafe TypeScript as assertions such as:
value as unknown as Target
value as Target
This is related to the previously closed #10, but the gap is broader: double assertions and ordinary unchecked object/array assertions can bypass structural type safety at database and external-data boundaries without any warning in strict mode.
Expected behavior
Strict analysis should report unsafe TypeScript assertions, including:
value as unknown as Target
- Unchecked object assertions such as
value as Record<string, unknown>
- Unchecked array or domain-row assertions such as
data as EventRow[]
The report should include the file, line, assertion form, and severity.
Scope boundaries
- Do not report
satisfies expressions as assertions.
- Avoid false positives for generated declaration files and framework-required boundary declarations where possible.
- Preserve the existing
any and unsafe-type detectors.
Reproduction
interface EventRow {
id: string;
}
const value: unknown = getExternalData();
const rows = value as unknown as EventRow[];
const record = value as Record<string, unknown>;
Neither assertion form was reported by npx karpeslop@latest --quiet --strict in the consuming project. Please add fixtures and regression tests for these patterns.
Problem
KarpeSlop does not currently report unsafe TypeScript
asassertions such as:This is related to the previously closed #10, but the gap is broader: double assertions and ordinary unchecked object/array assertions can bypass structural type safety at database and external-data boundaries without any warning in strict mode.
Expected behavior
Strict analysis should report unsafe TypeScript assertions, including:
value as unknown as Targetvalue as Record<string, unknown>data as EventRow[]The report should include the file, line, assertion form, and severity.
Scope boundaries
satisfiesexpressions as assertions.anyand unsafe-type detectors.Reproduction
Neither assertion form was reported by
npx karpeslop@latest --quiet --strictin the consuming project. Please add fixtures and regression tests for these patterns.