Skip to content

Commit

Permalink
fix: better types
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Sep 30, 2024
1 parent 457dd88 commit a83fed9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 6 deletions.
15 changes: 12 additions & 3 deletions packages/blueprints-integration/src/ingest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,10 @@ export interface MutableIngestRundown<TRundownPayload = unknown, TSegmentPayload
* @param key the key of the payload to update
* @param value the new value
*/
setPayloadProperty<TKey extends keyof TRundownPayload>(key: TKey, value: TRundownPayload[TKey]): void
setPayloadProperty<TKey extends keyof TRundownPayload>(
key: TKey,
value: ReadonlyDeep<TRundownPayload[TKey]> | TRundownPayload[TKey]
): void

setUserEditState(key: string, value: boolean): void
}
Expand Down Expand Up @@ -339,7 +342,10 @@ export interface MutableIngestSegment<TSegmentPayload = unknown, TPartPayload =
* @param key the key of the payload to update
* @param value the new value
*/
setPayloadProperty<TKey extends keyof TSegmentPayload>(key: TKey, value: TSegmentPayload[TKey]): void
setPayloadProperty<TKey extends keyof TSegmentPayload>(
key: TKey,
value: ReadonlyDeep<TSegmentPayload[TKey]> | TSegmentPayload[TKey]
): void

setUserEditState(key: string, value: boolean): void
}
Expand Down Expand Up @@ -373,7 +379,10 @@ export interface MutableIngestPart<TPartPayload = unknown> {
* @param key the key of the payload to update
* @param value the new value
*/
setPayloadProperty<TKey extends keyof TPartPayload>(key: TKey, value: TPartPayload[TKey]): void
setPayloadProperty<TKey extends keyof TPartPayload>(
key: TKey,
value: ReadonlyDeep<TPartPayload[TKey]> | TPartPayload[TKey]
): void

setUserEditState(key: string, value: boolean): void
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,10 @@ export class MutableIngestPartImpl<TPartPayload = unknown> implements MutableIng
}
}

setPayloadProperty<TKey extends keyof TPartPayload>(key: TKey, value: TPartPayload[TKey]): void {
setPayloadProperty<TKey extends keyof TPartPayload>(
key: TKey,
value: ReadonlyDeep<TPartPayload[TKey]> | TPartPayload[TKey]
): void {
if (!this.#ingestPart.payload) {
throw new Error('Part payload is not set')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,10 @@ export class MutableIngestRundownImpl<TRundownPayload = unknown, TSegmentPayload
}
}

setPayloadProperty<TKey extends keyof TRundownPayload>(key: TKey, value: TRundownPayload[TKey]): void {
setPayloadProperty<TKey extends keyof TRundownPayload>(
key: TKey,
value: ReadonlyDeep<TRundownPayload[TKey]> | TRundownPayload[TKey]
): void {
if (!this.ingestRundown.payload) {
throw new Error('Rundown payload is not set')
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,10 @@ export class MutableIngestSegmentImpl<TSegmentPayload = unknown, TPartPayload =
}
}

setPayloadProperty<TKey extends keyof TSegmentPayload>(key: TKey, value: TSegmentPayload[TKey]): void {
setPayloadProperty<TKey extends keyof TSegmentPayload>(
key: TKey,
value: ReadonlyDeep<TSegmentPayload[TKey]> | TSegmentPayload[TKey]
): void {
if (!this.#ingestSegment.payload) {
throw new Error('Segment payload is not set')
}
Expand Down

0 comments on commit a83fed9

Please sign in to comment.