• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#  Use generic functions instead of generic arrow functions
2
3Rule ``arkts-no-generic-lambdas``
4
5**Severity: error**
6
7ArkTS does not support generic arrow functions. Use normal generic functions
8instead.
9
10
11## TypeScript
12
13
14```
15
16    let generic_arrow_func = <T extends String> (x: T) => { return x }
17
18    generic_arrow_func("string")
19
20```
21
22## ArkTS
23
24
25```
26
27    function generic_func<T extends String>(x: T): T {
28        return x
29    }
30
31    generic_func<String>("string")
32
33```
34
35
36