From 715a66fd35dcc3e4330e99901911a95daa0fe182 Mon Sep 17 00:00:00 2001 From: Hide_D Date: Wed, 13 Apr 2022 02:49:11 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20APIPathGen=EC=97=90=EC=84=9C=20NumVar,?= =?UTF-8?q?=20StrVar=20=EB=8F=99=EC=9E=91=20=EC=98=A4=EB=A5=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- hwe/ts/util/APIPathGen.js | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hwe/ts/util/APIPathGen.js b/hwe/ts/util/APIPathGen.js index 41b0cb98..95093de0 100644 --- a/hwe/ts/util/APIPathGen.js +++ b/hwe/ts/util/APIPathGen.js @@ -14,16 +14,23 @@ export function APIPathGen(obj, callback, path, pathParams) { } const varType = target.__nextVarType; - const varKey = target.__nextVarKey; + let varKey = target.__nextVarKey; let next; if (varType !== undefined && varKey !== undefined) { - if (typeof key !== varType) { - throw `${key} is not ${varType}`; + if(varType == 'number'){ + if(key != Number(key)){ + throw `${key} is not ${varType}`; + } + key = Number(key); + } + else if ((typeof key) !== varType) { + throw `${key} is not ${varType}, but ${typeof key}`; } if(pathParams === undefined){ pathParams = {} } pathParams[varKey] = key; + nextPath.pop(); next = target.next; } else if (key in target) {