Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@ export const RuleForm: React.FunctionComponent<
RuleTypeParamsExpressionProps<GeoContainmentAlertParams>
> = (props) => {
function getValidationError(key: string) {
// @ts-expect-error upgrade typescript v5.1.6
return props.errors[key]?.length > 0 && key in props.ruleParams
? (props.errors[key] as string[])[0]
: null;
const error = props.errors[key];
if (Array.isArray(error) && error.length > 0 && key in props.ruleParams) {
return typeof error[0] === 'string' ? error[0] : null;
}
return null;
}

return (
Expand Down