• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#  Use inheritance instead of intersection types
2
3Rule ``arkts-no-intersection-types``
4
5**Severity: error**
6
7Currently, ArkTS does not support intersection types. Use inheritance
8as a workaround.
9
10
11## TypeScript
12
13
14```
15
16    interface Identity {
17        id: number
18        name: string
19    }
20
21    interface Contact {
22        email: string
23        phoneNumber: string
24    }
25
26    type Employee = Identity & Contact
27
28```
29
30## ArkTS
31
32
33```
34
35    interface Identity {
36        id: number
37        name: string
38    }
39
40    interface Contact {
41        email: string
42        phoneNumber: string
43    }
44
45    interface Employee extends Identity,  Contact {}
46
47```
48
49
50