The @the-draupnir-project/matrix-basic-types library provides specialized types for Matrix identifiers to prevent accidental mixing of string values. Instead of using generic strings, use the specific types provided for StringUserID, MatrixRoomID, and eventID. This ensures type safety when handling room IDs, user IDs, and event IDs throughout your application.
async function acceptInvitation(
inviteSender: StringUserID,
room: MatrixRoomID
): Promise<Result<void>> {
console.log(
`accepting invitation from ${inviteSender} to ${room.toPermalink()}`
);
return await client.joinRoom(room.toRoomIDOrAlias(), room.getViaServers());
}