• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#  Construct signatures are not supported in interfaces
2
3Rule ``arkts-no-ctor-signatures-iface``
4
5**Severity: error**
6
7ArkTS does not support construct signatures. Use methods instead.
8
9
10## TypeScript
11
12
13```
14
15    interface I {
16        new (s: string): I
17    }
18
19    function fn(i: I) {
20        return new i("hello")
21    }
22
23```
24
25## ArkTS
26
27
28```
29
30    interface I {
31        create(s: string): I
32    }
33
34    function fn(i: I) {
35        return i.create("hello")
36    }
37
38```
39
40## See also
41
42- Recipe 015:  Use ``class`` instead of a type with constructor signature (``arkts-no-ctor-signatures-type``)
43
44
45