ArkTs编译常见错误汇总(更新中)

1)arkt-no-props-by-index错误

修改:使用Record<string, Object>来转换,或者使用ObjectUtils.mapToObject()

2)ark-no-func-expressions 错误

解析:把function()换成()->

3)type ‘undefined’ cannot be used as an index type

解析:类型匹配异常。可以在变量创建时使用合并操作符?来兼容‘undefined’,例如:index?: number

4)the retrun type of an async function or method must be the global Promise type,Did you mean to write ‘Promise<xxx | undefined>’

解析:按照提示修改即可,将undefined放在<>中。