interface 和 implements 抽象和验证类的方法
    implements,表示对接口的实现,接口通过关键字interface 进行定义

    1. interface RadioProps {
    2. switchRadio(trigger: boolean): void
    3. }
    4. interface BatteryProps {
    5. battryStatus(): void
    6. }
    7. class Child implements RadioProps {
    8. switchRadio(trigger: boolean) {}
    9. }
    10. // 要实现多个接口
    11. class Child2 implements RadioProps, BatteryProps {
    12. switchRadio(trigger: boolean) {}
    13. BatteryProps () {}
    14. }
    15. // interface接口之间的继承
    16. interface BothSwitch extends RadioProps {
    17. battryStatus(): void
    18. }
    19. class Child3 implements BothSwitch {
    20. switchRadio(trigger: boolean) {}
    21. BatteryProps () {}
    22. }