refine TemplateFilter type

Signed-off-by: Matt Benson <gudnabrsam@gmail.com>
This commit is contained in:
Matt Benson
2025-02-07 11:40:19 -06:00
parent a706caf76b
commit 846ed95c0e
2 changed files with 6 additions and 2 deletions
@@ -190,7 +190,8 @@ export class SecureTemplater {
if (!Object.hasOwn(templateFilters, filterName)) {
return '';
}
const rz = templateFilters[filterName](...args);
const [input, ...rest] = args;
const rz = templateFilters[filterName](input, ...rest);
return rz === undefined ? '' : JSON.stringify(rz);
},
);
+4 -1
View File
@@ -17,7 +17,10 @@
import { JsonValue } from '@backstage/types';
/** @public */
export type TemplateFilter = (...args: JsonValue[]) => JsonValue | undefined;
export type TemplateFilter = (
arg: JsonValue,
...rest: JsonValue[]
) => JsonValue | undefined;
/** @public */
export type TemplateGlobal =