当前位置:网站首页>Interface (optimization type annotation)

Interface (optimization type annotation)

2022-06-22 16:36:00 xiao_ zhu_ ting_ feng

Interface ( Optimization type annotation , Name the type annotation of the object )

1. Use interface keyword , It becomes a module directly

interface IUser {

name:string

age:number

}

Use in objects ( Add... Directly after the object name :IUser that will do )

let p1: IUser = {

name: 'jack',

age:18

}

原网站

版权声明
本文为[xiao_ zhu_ ting_ feng]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206221522244550.html