AArtem UdovichenkoAdd ets2panda
0ee26c4f创建于 2023年10月10日历史提交

Use generic functions instead of generic arrow functions

Rule arkts-no-generic-lambdas

Severity: error

ArkTS does not support generic arrow functions. Use normal generic functions instead.

TypeScript


    let generic_arrow_func = <T extends String> (x: T) => { return x }

    generic_arrow_func("string")

ArkTS


    function generic_func<T extends String>(x: T): T {
        return x
    }

    generic_func<String>("string")