refine TemplateFilter type
Signed-off-by: Matt Benson <gudnabrsam@gmail.com>
This commit is contained in:
@@ -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);
|
||||
},
|
||||
);
|
||||
|
||||
@@ -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 =
|
||||
|
||||
Reference in New Issue
Block a user