From 1f9f8ad91140f513a1ee96329e3775ede9480d2d Mon Sep 17 00:00:00 2001 From: Deema Mykhailov Date: Wed, 3 Jan 2024 13:24:43 -0500 Subject: [PATCH] Fixes error when XHR has wrapper and returns proper js object instead of string --- ts/speech_rules/math_map.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ts/speech_rules/math_map.ts b/ts/speech_rules/math_map.ts index 9f715b668..116a6765a 100644 --- a/ts/speech_rules/math_map.ts +++ b/ts/speech_rules/math_map.ts @@ -165,8 +165,10 @@ function retrieveFiles(locale: string) { * * @param json The json mappings string. */ -function parseMaps(json: string) { - const js = JSON.parse(json) as { [key: string]: any[] }; +function parseMaps(json: string | MathMapJson) { + const js = (typeof json === 'string') ? + JSON.parse(json) as { [key: string]: any[] } + : json; addMaps(js); }