import { getRTCToken } from "../../../utils/AgoraToken" ; export const getCloudRecordData = async < T extends boolean > ( roomUUID , hasToken ) : Promise < T extends true ? CloudRecordDataToken : CloudRecordData > => { if ( hasToken === true ) { return { uid : "1" , cname : roomUUID , token : await getRTCToken ( roomUUID , 1 ) , } ; } return { uid : "1" , cname : roomUUID , } ; } ; interface CloudRecordData { uid : "1" ; cname : string ; } interface CloudRecordDataToken extends CloudRecordData { token : string ; }