Avoid Widening

Keep a type as narrow as the value it describes. An annotation wider than what inference already knows throws information away, so annotate only to add information. Keep immutable lookup tables literal with `as const satisfies`, type built keys with template literal types and build them `as const`, and widen on purpose only at a boundary where inference is unsound.

jiayaoqijia Updated 81 repo stars

File contents

jiayaoqijia/cryptoskill commit 353f6a8d69

Frequently asked questions

npx get-skill add jiayaoqijia/avoid-widening