Skip to content

Commit 33eb47e

Browse files
committed
added types to validate Batch Config
1 parent 56409cd commit 33eb47e

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

server/src/preFlight/validateBatchConfig.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -250,13 +250,14 @@ class ValidationError extends Error {
250250
}
251251
}
252252

253-
export function validateBatchConfig(config) {
253+
//changed line 260 errors type so it would throw no errors in deliberation-lab-tools, if it breaks something then revert this change
254+
export function validateBatchConfig(config: unknown) {
254255
const result = batchConfigSchema.safeParse(config);
255256
if (!result.success) {
256257
const errors = result.error.format();
257258
const generalErrors = errors["_errors"];
258259
const keyErrors = Object.keys(errors).map((key, index) =>
259-
key[0] !== "_" ? `${key}: ${errors[key]["_errors"]?.join(" - ")}` : ""
260+
key[0] !== "_" ? `${key}: ${(errors as Record<string, any>)[key]["_errors"]?.join(" - ")}` : ""
260261
);
261262
throw new ValidationError(
262263
`Problem(s) in batch config:\n- ${[...generalErrors, ...keyErrors].join(

0 commit comments

Comments
 (0)