diff --git a/packages/custom-functions-metadata/src/parseTree.ts b/packages/custom-functions-metadata/src/parseTree.ts index 7c1951cf0..e2f8dcdd7 100644 --- a/packages/custom-functions-metadata/src/parseTree.ts +++ b/packages/custom-functions-metadata/src/parseTree.ts @@ -160,6 +160,19 @@ const CELLVALUETYPE_MAPPINGS = { "Excel.ValueTypeNotAvailableCellValue": "unsupported", }; +const CELLVALUETYPE_TO_BASICTYPE_MAPPINGS = { + "cellvalue": "any", + "booleancellvalue": "boolean", + "doublecellvalue": "number", + "entitycellvalue": "any", + "errorcellvalue": "any", + "formattednumbercellvalue": "any", + "linkedentitycellvalue": "any", + "localimagecellvalue": "any", + "stringcellvalue": "string", + "webimagecellvalue": "any", +}; + type CustomFunctionsSchemaDimensionality = "invalid" | "scalar" | "matrix"; /** @@ -700,7 +713,8 @@ function getParameters(parameterItem: IGetParametersArguments): IFunctionParamet // for backward compatibility, we put cell value type in cellValueType instead of type. if (Object.values(CELLVALUETYPE_MAPPINGS).includes(ptype)) { - pMetadataItem.type = "any"; + // @ts-ignore + pMetadataItem.type = CELLVALUETYPE_TO_BASICTYPE_MAPPINGS[ptype]; pMetadataItem.cellValueType = ptype } diff --git a/packages/custom-functions-metadata/test/cases/input-parameter-types-cellvalue/expected.json b/packages/custom-functions-metadata/test/cases/input-parameter-types-cellvalue/expected.json index 3313fe0f0..994634b0a 100644 --- a/packages/custom-functions-metadata/test/cases/input-parameter-types-cellvalue/expected.json +++ b/packages/custom-functions-metadata/test/cases/input-parameter-types-cellvalue/expected.json @@ -21,7 +21,7 @@ "parameters": [ { "name": "x", - "type": "any", + "type": "boolean", "cellValueType": "booleancellvalue" } ], @@ -34,7 +34,7 @@ "parameters": [ { "name": "x", - "type": "any", + "type": "number", "cellValueType": "doublecellvalue" } ], @@ -112,7 +112,7 @@ "parameters": [ { "name": "x", - "type": "any", + "type": "string", "cellValueType": "stringcellvalue" } ], @@ -139,7 +139,7 @@ { "name": "x", "repeating": true, - "type": "any", + "type": "boolean", "cellValueType": "booleancellvalue" } ], @@ -153,7 +153,7 @@ { "dimensionality": "matrix", "name": "x", - "type": "any", + "type": "boolean", "cellValueType": "booleancellvalue" } ], @@ -168,7 +168,7 @@ "dimensionality": "matrix", "name": "x", "repeating": true, - "type": "any", + "type": "boolean", "cellValueType": "booleancellvalue" } ], @@ -182,7 +182,7 @@ { "name": "x", "repeating": true, - "type": "any", + "type": "boolean", "cellValueType": "booleancellvalue" } ], @@ -196,7 +196,7 @@ { "dimensionality": "matrix", "name": "x", - "type": "any", + "type": "boolean", "cellValueType": "booleancellvalue" } ], @@ -211,7 +211,7 @@ "dimensionality": "matrix", "name": "x", "repeating": true, - "type": "any", + "type": "boolean", "cellValueType": "booleancellvalue" } ],