Use TypeScript’s type system and modern JavaScript features to prevent null reference errors.

TypeScript type safety:

Modern JavaScript null checks:

// Do this: const citations = response.message.citations ?? [];


- Use optional chaining (`?.`) for accessing properties on potentially undefined objects:
```typescript
// Instead of this:
const contentType = requestClone.headers.get('content-type') || '';
if (contentType.startsWith('multipart/form-data')) { /*...*/ }

// Do this:
const contentType = requestClone.headers.get('content-type');
if (contentType?.startsWith('multipart/form-data')) { /*...*/ }

Following these patterns leads to more robust, self-documenting code and fewer runtime errors from unexpected null/undefined values.