commented ts-typeguard & improved validation error

This commit is contained in:
Felix Kaspar
2023-12-28 02:15:14 +01:00
parent 8d9c24b09b
commit f87fb32913
2 changed files with 7 additions and 7 deletions

View File

@@ -36,8 +36,8 @@ export function validateOperations(actions: Action[]): { valid: boolean, reason?
for (const afterDoneChild of done[childAction.values.id]?.actions || []) {
const receivingOperator = getOperatorByName(afterDoneChild.type);
if (!receivingOperator) {
return { valid: false, reason: `The receiving operator ${afterDoneChild.type} does not exist.` };
if (receivingOperator === undefined) {
return { valid: false, reason: `action.type ${afterDoneChild.type} does not exist.` };
} else if (!ioCompatible(operator, receivingOperator)) {
return { valid: false, reason: `Ouput of action ${action.type} is not compatible with input of action ${afterDoneChild.type}` };
}
@@ -48,8 +48,8 @@ export function validateOperations(actions: Action[]): { valid: boolean, reason?
}
else {
const receivingOperator = getOperatorByName(childAction.type);
if (!receivingOperator) {
return { valid: false, reason: `The receiving operator ${childAction.type} does not exist.` };
if (receivingOperator === undefined) {
return { valid: false, reason: `action.type ${childAction.type} does not exist.` };
} else if (!ioCompatible(operator, receivingOperator)) {
return { valid: false, reason: `Ouput of action ${action.type} is not compatible with input of action ${childAction.type}` };
}