Overview
You can augment theFetchOptions interface to add custom properties with full TypeScript support. This is useful for adding domain-specific options that work throughout your application.
Basic Usage
Place this in any.ts or .d.ts file in your project:
Ensure the file is included in your
tsconfig.json “files” or covered by “include” patterns.Using Augmented Types
Once augmented, your custom properties are available everywhere:Example from README
FromREADME.md:356-384:
ofetch calls:
Common Use Cases
Authentication Requirements
Cache Control
Rate Limiting
API Versioning
Request Tracking
Multiple Augmentations
You can augment the interface multiple times:Context Types
Fromsrc/types.ts:94-99:
context.options: