diff --git a/v2/internal/binding/generate.go b/v2/internal/binding/generate.go index 26ea614d7..85f394487 100644 --- a/v2/internal/binding/generate.go +++ b/v2/internal/binding/generate.go @@ -129,7 +129,13 @@ func goTypeToJSDocType(input string, importNamespaces *slicer.StringSlicer) stri return "string" case strings.HasPrefix(input, "map"): temp := strings.TrimPrefix(input, "map[") - keyType, valueType, _ := strings.Cut(temp, "]") + // Split the string into the key and value types + tempSplit := strings.SplitN(temp, "]", 2) + if len(tempSplit) < 2 { + panic("Invalid map type provided: " + input) + } + keyType := tempSplit[0] + valueType := tempSplit[1] return fmt.Sprintf("{[key: %s]: %s}", goTypeToJSDocType(keyType, importNamespaces), goTypeToJSDocType(valueType, importNamespaces)) case strings.HasPrefix(input, "[]"): arrayType := goTypeToJSDocType(input[2:], importNamespaces)