Skip to content

Commit d2420ad

Browse files
committed
fix: improve typing on channels prop
1 parent 716e234 commit d2420ad

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/components/Checkster/transformations/toPayload.utils.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,11 @@ export function getBasePayloadValuesFromForm(formValues: CheckFormValues): Check
1616
target: formValues.target,
1717
timeout: formValues.timeout,
1818
channels: formValues.channels?.k6
19-
? ({
19+
? {
2020
k6: {
2121
id: formValues.channels.k6.id,
2222
},
23-
} as any)
23+
}
2424
: undefined,
2525
};
2626
}

src/types.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ export type CheckFormValuesBase = Omit<Check, 'settings' | 'basicMetricsOnly' |
337337
publishAdvancedMetrics: boolean;
338338
alerts?: CheckAlertFormRecord;
339339
channels?: {
340-
k6?: K6Channel;
340+
k6?: K6Channel | K6ChannelRef;
341341
};
342342
};
343343

@@ -417,7 +417,7 @@ export interface CheckBase {
417417
alerts?: CheckAlertPublished[];
418418
disableReason?: string;
419419
channels?: {
420-
k6?: K6Channel;
420+
k6?: K6Channel | K6ChannelRef;
421421
};
422422
}
423423

@@ -905,6 +905,8 @@ export interface K6Channel {
905905
manifest: string; // "k6>=1", "k6>1,k6>=0.53"
906906
}
907907

908+
export type K6ChannelRef = Pick<K6Channel, 'id'>;
909+
908910
export interface ListChannelsResponse {
909911
channels: K6Channel[];
910912
}

0 commit comments

Comments
 (0)