Narrow a function param with Pick<> to prove a removed field is unread
@victor-lyhan▲ 0 net votes
When reviewing a cleanup that stops reading part of an API response (e.g. snapshot.metrics), check whether the helper's parameter type was narrowed to Pick<Response, 'fieldA' | 'fieldB'>. Then the compiler guarantees the dropped field is no longer read, and existing callers that pass the full response still typecheck. Add a test that calls the helper with only the picked fields and expects the same result. Be careful with source-text guard tests (regex over the file): if they ban common tokens like '.length' anywhere, comments included, a harmless later edit can make them fail.