Skip to content

Commit 543e272

Browse files
authored
Merge branch 'DefinitelyTyped:master' into master
2 parents db5d526 + 1902c63 commit 543e272

File tree

7 files changed

+251
-26
lines changed

7 files changed

+251
-26
lines changed

types/arc4/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,10 @@
1111
"dependencies": {
1212
"@types/node": "*"
1313
},
14-
"owners": []
14+
"owners": [
15+
{
16+
"name": "Maximilian Hofmann",
17+
"githubUsername": "maxiicodes"
18+
}
19+
]
1520
}

types/chromecast-caf-receiver/cast.framework.d.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -568,7 +568,12 @@ export class PlayerManager {
568568
/**
569569
* Sends a media status message to all senders (broadcast). Applications use this to send a custom state change.
570570
*/
571-
broadcastStatus(includeMedia?: boolean, requestId?: number, customData?: any, includeQueueItems?: boolean): void;
571+
broadcastStatus(
572+
includeMedia?: boolean,
573+
requestId?: number,
574+
customData?: messages.MediaStatusCustomData | null,
575+
includeQueueItems?: boolean,
576+
): void;
572577

573578
/**
574579
* Convert media time to absolute time.
@@ -736,7 +741,7 @@ export class PlayerManager {
736741
requestId: number,
737742
type: messages.ErrorType,
738743
reason?: messages.ErrorReason,
739-
customData?: any,
744+
customData?: unknown,
740745
): void;
741746

742747
/**
@@ -751,7 +756,7 @@ export class PlayerManager {
751756
senderId: string,
752757
requestId: number,
753758
includeMedia?: boolean,
754-
customData?: any,
759+
customData?: messages.MediaStatusCustomData | null,
755760
includeQueueItems?: boolean,
756761
): void;
757762

types/chromecast-caf-receiver/cast.framework.messages.d.ts

Lines changed: 85 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -610,6 +610,18 @@ export class AudioTrackInfo {
610610
*/
611611
spatialAudio?: boolean | undefined;
612612
}
613+
614+
/**
615+
* Custom data set by the receiver application.
616+
*
617+
* @remarks
618+
*
619+
* Augment this interface in custom receivers.
620+
*/
621+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
622+
export interface TrackCustomData {
623+
}
624+
613625
/**
614626
* Describes track metadata information.
615627
* @see https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages.Track
@@ -625,7 +637,7 @@ export class Track {
625637
/**
626638
* Custom data set by the receiver application.
627639
*/
628-
customData?: any;
640+
customData?: TrackCustomData;
629641

630642
/**
631643
* Indicate track is in-band and not side-loaded track. Relevant only for text tracks.
@@ -683,6 +695,17 @@ export class Track {
683695
roles?: string[] | undefined;
684696
}
685697

698+
/**
699+
* Custom data set by the receiver application.
700+
*
701+
* @remarks
702+
*
703+
* Augment this interface in custom receivers.
704+
*/
705+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
706+
export interface TextTrackStyleCustomData {
707+
}
708+
686709
/**
687710
* Describes style information for a text track.
688711
* @see https://developers.google.com/cast/docs/reference/web_receiver/cast.framework.messages.TextTrackStyle
@@ -696,7 +719,7 @@ export class TextTrackStyle {
696719
/**
697720
* Custom data set by the receiver application.
698721
*/
699-
customData?: any;
722+
customData?: TextTrackStyleCustomData;
700723

701724
/**
702725
* RGBA color for the edge; this value will be ignored if edgeType is NONE.
@@ -818,6 +841,17 @@ export class SetCredentialsRequestData extends RequestData {
818841
source?: string | undefined;
819842
}
820843

844+
/**
845+
* Customizable object for storing session state.
846+
*
847+
* @remarks
848+
*
849+
* Augment this interface in custom receivers.
850+
*/
851+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
852+
export interface SessionStateCustomData {
853+
}
854+
821855
/**
822856
* A state object containing all data to be stored in StoreSession and to be
823857
* recovered in ResumeSession.
@@ -829,7 +863,7 @@ export class SessionState {
829863
/**
830864
* Customizable object for storing the state.
831865
*/
832-
customData?: any;
866+
customData?: SessionStateCustomData;
833867

834868
loadRequestData?: LoadRequestData | undefined;
835869
}
@@ -1103,6 +1137,17 @@ export class QueueLoadRequestData extends RequestData {
11031137
startIndex?: number | undefined;
11041138
}
11051139

1140+
/**
1141+
* The application can define any extra queue item information needed.
1142+
*
1143+
* @remarks
1144+
*
1145+
* Augment this interface in custom receivers.
1146+
*/
1147+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
1148+
export interface QueueItemCustomData {
1149+
}
1150+
11061151
/**
11071152
* Queue item information. Application developers may need to create a QueueItem to
11081153
* insert a queue element using InsertQueueItems. In this case they should not
@@ -1128,7 +1173,7 @@ export class QueueItem {
11281173
/**
11291174
* The application can define any extra queue item information needed.
11301175
*/
1131-
customData?: any;
1176+
customData?: QueueItemCustomData;
11321177

11331178
/**
11341179
* Unique identifier of the item in the queue.
@@ -1637,6 +1682,17 @@ export class MovieMediaMetadata {
16371682
title?: string | undefined;
16381683
}
16391684

1685+
/**
1686+
* Applicaiton-specific media status.
1687+
*
1688+
* @remarks
1689+
*
1690+
* Augment this interface in custom receivers.
1691+
*/
1692+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
1693+
export interface MediaStatusCustomData {
1694+
}
1695+
16401696
/**
16411697
* Represents the status of a media session.
16421698
* [Documentation]{@link https://developers.google.com/cast/docs/reference/caf_receiver/cast.framework.messages.MediaStatus}
@@ -1668,7 +1724,7 @@ export class MediaStatus {
16681724
/**
16691725
* Application-specific media status.
16701726
*/
1671-
customData?: any;
1727+
customData?: MediaStatusCustomData;
16721728

16731729
/**
16741730
* Extended media status information.
@@ -1804,6 +1860,17 @@ export class MediaMetadata {
18041860
sectionStartTimeInMedia?: number | undefined;
18051861
}
18061862

1863+
/**
1864+
* Application-specific media information.
1865+
*
1866+
* @remarks
1867+
*
1868+
* Augment this interface in custom receivers.
1869+
*/
1870+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
1871+
export interface MediaInformationCustomData {
1872+
}
1873+
18071874
/**
18081875
* Represents the media information.
18091876
* @see https://developers.google.com/cast/docs/reference/web_receiver/cast.framework.messages.MediaInformation
@@ -1841,7 +1908,7 @@ export class MediaInformation {
18411908
/**
18421909
* Application-specific media information.
18431910
*/
1844-
customData?: any;
1911+
customData?: MediaInformationCustomData;
18451912

18461913
/**
18471914
* The media duration.
@@ -2383,6 +2450,17 @@ export class BreakStatus {
23832450
whenSkippable?: number | undefined;
23842451
}
23852452

2453+
/**
2454+
* Application-specific break clip data.
2455+
*
2456+
* @remarks
2457+
*
2458+
* Augment this interface in custom receivers.
2459+
*/
2460+
// eslint-disable-next-line @typescript-eslint/no-empty-interface
2461+
export interface BreakClipCustomData {
2462+
}
2463+
23862464
/**
23872465
* Represents break clip (e.g. a clip of ad during ad break)
23882466
* @see https://developers.google.com/cast/docs/reference/web_receiver/cast.framework.messages.BreakClip
@@ -2411,7 +2489,7 @@ export class BreakClip {
24112489
/**
24122490
* Application-specific break clip data.
24132491
*/
2414-
customData?: any;
2492+
customData?: BreakClipCustomData;
24152493
/**
24162494
* Duration of break clip in sec.
24172495
*/

types/chromecast-caf-receiver/chromecast-caf-receiver-tests.ts

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,3 +283,47 @@ tracksInfo.activeTrackIds = [1, 2];
283283
tracksInfo.language = "en";
284284
tracksInfo.textTrackStyle = new cast.framework.messages.TextTrackStyle();
285285
tracksInfo.tracks = [new cast.framework.messages.Track(1, cast.framework.messages.TrackType.AUDIO)];
286+
287+
// You can extend the types of some customData fields via declaration merging, so that
288+
// custom data passed between your custom receiver and CAF remains statically typed.
289+
290+
declare module "./cast.framework.messages" {
291+
interface TrackCustomData {
292+
dialect?: string;
293+
}
294+
295+
interface TextTrackStyleCustomData {
296+
lineHeight?: number;
297+
}
298+
299+
interface SessionStateCustomData {
300+
userId?: string;
301+
}
302+
303+
interface QueueItemCustomData {
304+
priority?: number;
305+
}
306+
307+
interface MediaStatusCustomData {
308+
description?: string;
309+
}
310+
311+
interface MediaInformationCustomData {
312+
environment: "production" | "staging";
313+
}
314+
315+
interface BreakClipCustomData {
316+
advertiser?: string;
317+
}
318+
}
319+
320+
const sessionState = new cast.framework.messages.SessionState();
321+
const mediaStatus = new cast.framework.messages.MediaStatus();
322+
323+
track.customData = { dialect: "关中话" };
324+
tracksInfo.textTrackStyle!.customData = { lineHeight: 1.5 };
325+
sessionState.customData = { userId: "1234" };
326+
mediaStatus.customData = { description: "Lorem ipsum" };
327+
queueItem.customData = { priority: 1 };
328+
queueItem.media.customData = { environment: "production" };
329+
breakClip.customData = { advertiser: "Umbrella Corporation" };

types/exaroton/package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,10 @@
1313
"devDependencies": {
1414
"@types/exaroton": "workspace:."
1515
},
16-
"owners": []
16+
"owners": [
17+
{
18+
"name": "Maximilian Hofmann",
19+
"githubUsername": "maxiicodes"
20+
}
21+
]
1722
}

0 commit comments

Comments
 (0)