Skip to content

Commit

Permalink
Remove generics
Browse files Browse the repository at this point in the history
  • Loading branch information
JiaweiWu committed Apr 22, 2024
1 parent 02afccb commit d54c6ec
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ const getShouldScheduleTask = async (
}
};

export const bulkEnableRules = async <Params extends RuleParams = never>(
export const bulkEnableRules = async <Params extends RuleParams>(
context: RulesClientContext,
params: BulkEnableRulesParams
): Promise<BulkEnableRulesResult<Params>> => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface BulkEnableRulesError {
}

// TODO (http-versioning): This should be of type Rule, change this when all rule types are fixed
export interface BulkEnableRulesResult<Params extends RuleParams = never> {
export interface BulkEnableRulesResult<Params extends RuleParams> {
rules: Array<SanitizedRule<Params>>;
errors: BulkEnableRulesError[];
total: number;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const bulkEnableRulesRoute = ({

const body: BulkEnableRulesRequestBodyV1 = req.body;
try {
const result = await rulesClient.bulkEnableRules<RuleParamsV1>({
const result = await rulesClient.bulkEnableRules({
filter: body.filter,
ids: body.ids,
});
Expand Down
3 changes: 1 addition & 2 deletions x-pack/plugins/alerting/server/rules_client/rules_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,7 @@ export class RulesClient {
bulkDeleteRules(this.context, options);
public bulkEdit = <Params extends RuleTypeParams>(options: BulkEditOptions<Params>) =>
bulkEditRules<Params>(this.context, options);
public bulkEnableRules = <Params extends RuleTypeParams = never>(params: BulkEnableRulesParams) =>
bulkEnableRules<Params>(this.context, params);
public bulkEnableRules = (params: BulkEnableRulesParams) => bulkEnableRules(this.context, params);
public bulkDisableRules = (options: BulkDisableRulesRequestBody) =>
bulkDisableRules(this.context, options);

Expand Down

0 comments on commit d54c6ec

Please sign in to comment.