interface接口
const screenResume = (name:string,age:number,bust:number)=>{
age < 24 && bust >= 90 && console.log(name+'进入面试')
age >= 24 || bust < 90 && console.log(name + '被淘汰')
}
screenResume('大脚',18,89)
const getResume = (name:string,age:number,bust:number)=>{
console.log(name+'年龄是'+age)
console.log(name+'胸围是'+bust)
}
getResume('大脚',18,89)
interface Girl {
name:string;
age:number;
bust:number;
yaoWei ?:number;
}
const screenResume = (girl:Girl)=>{
girl.age < 24 && girl.bust >= 90 && console.log(girl.name+'进入面试')
girl.age >= 24 || girl.bust < 90 && console.log(girl.name + '被淘汰')
}
const getResume = (girl:Girl)=>{
console.log(girl.name+'年龄是'+girl.age)
console.log(girl.name+'胸围是'+girl.bust)
girl.yaoWei && console.log(girl.name + '腰围是'+girl.yaoWei)
}
const var1 = {
name:'大脚',
age:18,
bust:94
}
screenResume(var1)
getResume(var1)
type Girl1 = string
interface Girl {
name:string;
age:number;
bust:number;
yaoWei ?:number;
[propName:string]:any;
say():string;
}
const var1 = {
name:'大脚',
age:18,
bust:94,
sex:'nv',
height:180,
say() {
return 'hello world';
}
}
class a implments Girl {
name='刘颖'
age=18
bust=90
say(){
return 'hello world'
}
interface Teacher extends Girl {
teach():string;
}
}