Skip to content

Commit 16e3e09

Browse files
committed
feat: support custom types from tsr plugins
1 parent c559e2f commit 16e3e09

File tree

1 file changed

+30
-24
lines changed
  • packages/timeline-state-resolver-types/src

1 file changed

+30
-24
lines changed

packages/timeline-state-resolver-types/src/index.ts

Lines changed: 30 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ export interface TimelineDatastoreReferencesContent {
8787

8888
export type TSRTimeline = TSRTimelineObj<TSRTimelineContent>[]
8989

90-
export interface TSRTimelineObj<TContent extends { deviceType: DeviceType }>
90+
export interface TSRTimelineObj<TContent extends { deviceType: DeviceTypeExt }>
9191
extends Omit<Timeline.TimelineObject<TContent & TimelineDatastoreReferencesContent>, 'children'>,
9292
TSRTimelineObjProps {
9393
children?: TSRTimelineObj<TSRTimelineContent>[]
@@ -98,29 +98,35 @@ export interface TimelineContentEmpty extends Content {
9898
type: 'empty'
9999
}
100100

101-
export type TSRTimelineContent =
102-
| TimelineContentEmpty
103-
| TimelineContentAbstractAny
104-
| TimelineContentAtemAny
105-
| TimelineContentCasparCGAny
106-
| TimelineContentHTTPSendAny
107-
| TimelineContentTCPSendAny
108-
| TimelineContentHyperdeckAny
109-
| TimelineContentLawoAny
110-
| TimelineContentOBSAny
111-
| TimelineContentOSCAny
112-
| TimelineContentPharosAny
113-
| TimelineContentPanasonicPtzAny
114-
| TimelineContentQuantelAny
115-
| TimelineContentShotoku
116-
| TimelineContentSisyfosAny
117-
| TimelineContentSofieChefAny
118-
| TimelineContentSingularLiveAny
119-
| TimelineContentVMixAny
120-
| TimelineContentVIZMSEAny
121-
| TimelineContentTelemetricsAny
122-
| TimelineContentTriCasterAny
123-
| TimelineContentWebSocketClientAny
101+
// An extended DeviceType that also includes string keys for TSR plugins
102+
export type DeviceTypeExt = DeviceType | keyof TimelineContentMap
103+
104+
// A map of the known Content types. TSR plugins can be injected here when needed
105+
export interface TimelineContentMap {
106+
[DeviceType.ABSTRACT]: TimelineContentAbstractAny | TimelineContentEmpty
107+
[DeviceType.ATEM]: TimelineContentAtemAny
108+
[DeviceType.CASPARCG]: TimelineContentCasparCGAny
109+
[DeviceType.HTTPSEND]: TimelineContentHTTPSendAny
110+
[DeviceType.TCPSEND]: TimelineContentTCPSendAny
111+
[DeviceType.HYPERDECK]: TimelineContentHyperdeckAny
112+
[DeviceType.LAWO]: TimelineContentLawoAny
113+
[DeviceType.OBS]: TimelineContentOBSAny
114+
[DeviceType.OSC]: TimelineContentOSCAny
115+
[DeviceType.PHAROS]: TimelineContentPharosAny
116+
[DeviceType.PANASONIC_PTZ]: TimelineContentPanasonicPtzAny
117+
[DeviceType.QUANTEL]: TimelineContentQuantelAny
118+
[DeviceType.SHOTOKU]: TimelineContentShotoku
119+
[DeviceType.SISYFOS]: TimelineContentSisyfosAny
120+
[DeviceType.SOFIE_CHEF]: TimelineContentSofieChefAny
121+
[DeviceType.SINGULAR_LIVE]: TimelineContentSingularLiveAny
122+
[DeviceType.VMIX]: TimelineContentVMixAny
123+
[DeviceType.VIZMSE]: TimelineContentVIZMSEAny
124+
[DeviceType.TELEMETRICS]: TimelineContentTelemetricsAny
125+
[DeviceType.TRICASTER]: TimelineContentTriCasterAny
126+
[DeviceType.WEBSOCKET_CLIENT]: TimelineContentWebSocketClientAny
127+
}
128+
129+
export type TSRTimelineContent = TimelineContentMap[keyof TimelineContentMap]
124130

125131
/**
126132
* A simple key value store that can be referred to from the timeline objects

0 commit comments

Comments
 (0)