Earlier this year I got pulled into some urgent CCPA-related work. In short, the service wasn’t properly closing related tickets as they came off of the queue, and this was causing a massive backlog of manual work. Absolutely no fun for anybody involved.
During my investigation, I discovered a couple of distressing errors in the record we were sending:
The mandatory serviceNowTaskId was misspelled (inconsistently to boot) in several key places. For example, servideNowTaskid 😬
Worse, clientRequestId (also necessary) was completely missing from every call, compounding the failures 💨
// An example of what this looked like in practice
sendRecords({
records: [
{
status: ‘OK’,
payload: {
assetId: 12345,
servidenowTaskid: ‘doomed for failure’,
workNotes: ‘What could go wrong?’,
},
},
],
topic: ‘It be like this sometimes’,
});
Keep in mind, this project is written in TypeScript, so I was very curious as to why this was even possible in the first place. A quick bit of snooping around for the culprit interface revealed, to my horror, this:
export interface SendRecordRequest {
readonly records: ReadonlyArray; 🤦‍♂️
readonly topic: string;
}
The dreaded any ! That explained why there was no type checking to catch the error originally. Very likely a rushed feature, and in need of a bit of diligence.

#typescript #software-development #programming #javascript #software-engineering

Typical TypeScript: Using Unions to Enforce Inputs
1.10 GEEK