Skip to content

Commit 38746a3

Browse files
feat: preare kind common type for parsed audio/video stream stats
1 parent 6520a75 commit 38746a3

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

src/types.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,3 +435,16 @@ export interface Logger {
435435
warn: (msg: any, ...meta: any[]) => void;
436436
error: (msg: any, ...meta: any[]) => void;
437437
}
438+
439+
type CommonKeys<T, U> = Extract<keyof T, keyof U>;
440+
441+
type CommonFields<T, U> = {
442+
[K in CommonKeys<T, U>]: T[K] extends object
443+
? U[K] extends object
444+
? CommonFields<T[K], U[K]> // Recursively check nested objects
445+
: never
446+
: T[K];
447+
};
448+
449+
450+
export type CommonParsedInboundStreamStats = CommonFields<ParsedInboundVideoStreamStats, ParsedInboundAudioStreamStats>

0 commit comments

Comments
 (0)