Best pattern to replace unchecked casts for request options in TypeScript