From 7eaccea1f0fc4ccdfca2436a54607bb330e78fb7 Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Sat, 13 Apr 2024 01:16:53 +0200 Subject: [PATCH] Add test and explicit typing --- src/Models/ThemeConfig/Conversion/PrepareLayer.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Models/ThemeConfig/Conversion/PrepareLayer.ts b/src/Models/ThemeConfig/Conversion/PrepareLayer.ts index cd2a50dbb..069d2ffaf 100644 --- a/src/Models/ThemeConfig/Conversion/PrepareLayer.ts +++ b/src/Models/ThemeConfig/Conversion/PrepareLayer.ts @@ -502,6 +502,12 @@ export class AddQuestionBox extends DesugaringStep { ) } + /** + * const action = new AddQuestionBox() + * const tagRenderings = [{id:"questions", render: {"*": "{questions()}" } }] + * const conv = action.convert({tagRenderings}, ConversionContext.construct(["test"], [])) + * conv.tagRenderings // => [{id:"questions", render: {"*": "{questions()}" } }] + */ convert(json: LayerConfigJson, context: ConversionContext): LayerConfigJson { if ( json.tagRenderings === undefined || @@ -515,7 +521,7 @@ export class AddQuestionBox extends DesugaringStep { json = { ...json } json.tagRenderings = [...json.tagRenderings] const allSpecials: Exclude[] = ( - ValidationUtils.getAllSpecialVisualisations(json.tagRenderings).filter( + ValidationUtils.getAllSpecialVisualisations( json.tagRenderings).filter( (spec) => typeof spec !== "string" ) ) @@ -539,7 +545,7 @@ export class AddQuestionBox extends DesugaringStep { ) ) ) - const seen = new Set() + const seen: Set = new Set() for (const questionSpecial of questionSpecials) { if (typeof questionSpecial === "string") { continue