There might be a way to do it, via Generic Interface.
interface RTCPeerExchange<T extends "offer" | "answer"> { from: string; type: T; data: T extends "offer" ? RTCSessionDescriptionInit : RTCSessionDescriptionInit; }
Check if this helps.