Skip to content

Commit

Permalink
hacks to work around type errors from zod
Browse files Browse the repository at this point in the history
  • Loading branch information
pmuellr committed Jan 28, 2025
1 parent f2dc61d commit c7902c4
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ export const RuleFieldsToUpgrade = z
.strict();

export type RuleUpgradeSpecifier = z.infer<typeof RuleUpgradeSpecifier>;
// @ts-expect-error
export const RuleUpgradeSpecifier = z.object({
rule_id: RuleSignatureId,
revision: z.number(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ export const assertPickVersionIsTarget = ({ requestBody, ruleId }: AssertRuleTyp
pickVersions.push(rulePayload?.pick_version ?? requestBody.pick_version ?? 'MERGED');

if (rulePayload?.fields) {
const fieldPickValues = Object.values(rulePayload?.fields).map((field) => field.pick_version);
const fieldPickValues = Object.values(rulePayload?.fields).map(
// eslint-disable-next-line @typescript-eslint/no-explicit-any
(field) => (field as any).pick_version
);
pickVersions.push(...fieldPickValues);
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ export const getUpgradeableRules = ({
error: new Error(
`Rule with rule_id "${rule.rule_id}" and version "${rule.version}" not found`
),
item: rule,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
item: rule as any,
});
return;
}
Expand All @@ -66,7 +67,8 @@ export const getUpgradeableRules = ({
error: new Error(
`Revision mismatch for rule_id ${rule.rule_id}: expected ${currentRevision}, got ${rule.revision}`
),
item: rule,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
item: rule as any,
});
// Remove the rule from the list of upgradeable rules
if (upgradeableRules.has(rule.rule_id)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,8 @@ export const performRuleUpgradeRoute = (
const ruleTriadsMap = await fetchRuleVersionsTriad({
ruleAssetsClient,
ruleObjectsClient,
versionSpecifiers,
// eslint-disable-next-line @typescript-eslint/no-explicit-any
versionSpecifiers: versionSpecifiers as any,
});
const ruleGroups = getRuleGroups(ruleTriadsMap);

Expand Down

0 comments on commit c7902c4

Please sign in to comment.