Skip to content

prefer-typed-reflection

Prefer typed access when Reflect.get or Reflect.apply discards a known contract.

Why

Reflect.get and Reflect.apply can accept property or argument mistakes that normal typed access catches.

Fix

Use direct typed property access or call the typed function, preserving receivers and evaluation semantics.

Examples

Before — flagged Preserve the explicit contract
src/example.ts
declare const shipment: { status: string };
const status = Reflect.get(shipment, "status");
After — preferred Use the direct contract
src/example.ts
declare const shipment: { status: string };
const status = shipment.status;