fp-ts Option and Either
Installation
SKILL.md
fp-ts Option and Either Guide
This skill covers practical usage of Option and Either from fp-ts for safer TypeScript code.
When to Use Option vs Either
Use Option when:
- A value may or may not exist (nullable/undefined scenarios)
- You don't need to know WHY a value is missing
- Working with optional fields, array lookups, or dictionary access
Use Either when:
- An operation can fail and you need error information
- Replacing try-catch blocks
- You need to communicate different failure reasons
- Building validation pipelines