twilio-node icon indicating copy to clipboard operation
twilio-node copied to clipboard

Type definition mismatch: `groupingSids` in RecordingInstance typed as objects but returns strings

Open realies opened this issue 8 months ago • 2 comments

Issue Description

In Twilio SDK 5.5.2, there's a mismatch between TypeScript definitions and actual runtime behavior for the groupingSids property in the RecordingInstance interface. The TypeScript definitions specify groupingSids as Record<string, object>, but at runtime, the values are strings.

TypeScript Definition

// From node_modules/twilio/lib/rest/video/v1/recording.d.ts
export declare class RecordingInstance {
  // ...
  /**
   * A list of SIDs related to the recording. Includes the `room_sid` and `participant_sid`.
   */
  groupingSids: Record<string, object>;
  // ...
}

Actual Runtime Value

When logging the values from a real API response:

console.error('Debug:', { roomSid: recordings[0].groupingSids.room_sid });
// Output: Debug: { roomSid: 'RM368fba367c70b5de88fb174180ad4a45' }

console.error('Debug:', { participantSid: recording.groupingSids.participant_sid });
// Output: Debug: { participantSid: 'PA82a37dea2c02488621cf0b89d0d69b53' }

Raw JSON response from the API:

"groupingSids": {
  "participant_sid": "PA82a37dea2c02488621cf0b89d0d69b53",
  "room_sid": "RM368fba367c70b5de88fb174180ad4a45"
}

Impact

This type mismatch causes TypeScript errors when using these values in functions that expect strings, such as:

// Error: Argument of type 'object' is not assignable to parameter of type 'string | Uint8Array<ArrayBufferLike>'
uuidv5(roomSid, uuidv5.URL)

Environment

  • Twilio SDK version: 5.5.2
  • Node.js version: v22.14.0
  • TypeScript version: 5.x

Workaround

Currently using String() to force the correct type:

uuidv5(String(roomSid), uuidv5.URL)

Proposed Fix

Update the type definition to correctly reflect the runtime behavior:

groupingSids: Record<string, string>;

Thank you for your attention to this issue!

realies avatar Apr 18 '25 20:04 realies

Thanks for this issue. We are taking a look here.

manisha1997 avatar May 01 '25 16:05 manisha1997

I noticed that many occurrences of any have been wrongly replaced with Record<string, object>.

andrucz avatar May 29 '25 13:05 andrucz

We are working on resolving this. The conversation is going https://github.com/twilio/twilio-node/issues/1076

manisha1997 avatar Jun 26 '25 13:06 manisha1997

This has been fixed in 5.7.3 thanks!

tiwarishubham635 avatar Jul 14 '25 08:07 tiwarishubham635