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

Use inheritance instead of intersection types

Rule arkts-no-intersection-types

Severity: error

Currently, ArkTS does not support intersection types. Use inheritance as a workaround.

TypeScript


    interface Identity {
        id: number
        name: string
    }

    interface Contact {
        email: string
        phoneNumber: string
    }

    type Employee = Identity & Contact

ArkTS


    interface Identity {
        id: number
        name: string
    }

    interface Contact {
        email: string
        phoneNumber: string
    }

    interface Employee extends Identity,  Contact {}