Re: [heycam/webidl] Represent objects with both specified and unspecified members (#568)

>I don't understand why they don't use the types you suggest instead

The WebRTC spec [defines RTCStatsReport as](https://w3c.github.io/webrtc-pc/#rtcstatsreport-object):

>An RTCStatsReport object is a map between strings that identify the inspected objects (id attribute in RTCStats instances), and their corresponding RTCStats-derived dictionaries.

The RTCStats-derived dictionaries are defined in [a separate spec](https://www.w3.org/TR/webrtc-stats/#stats-dictionaries) by dictionary inheritance.

```webidl
// The base dictionary in WebRTC
dictionary RTCStats {
    required DOMHighResTimeStamp timestamp;
    required RTCStatsType        type;
    required DOMString           id;
};

// The "Identifiers for WebRTC's Statistics API" spec shows several subdictionaries
dictionary RTCRtpStreamStats : RTCStats {
    unsigned long      ssrc;
    DOMString          kind;
    DOMString          transportId;
    DOMString          codecId;
    unsigned long      firCount;
    unsigned long      pliCount;
    unsigned long      nackCount;
    unsigned long      sliCount;
    unsigned long long qpSum;
};

dictionary RTCCodecStats : RTCStats: {
  // ...
};

// ...
```

So the RTCStatsReport is expected to include those dictionaries as it is, not reduced as RTCStats.

```js
const rtcStatsReport = await receiver.getStats();
rtcStatsReport.get(key).ssrc // not in base RTCStats but should exist when appropriate
```

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/heycam/webidl/issues/568#issuecomment-398362931

Received on Tuesday, 19 June 2018 11:14:18 UTC