interface labelValue {
label:string;
name:string;
age?:number;
readonly title:string
}
function checkLabel(labelObj:labelValue){
console.log(labelObj.label,labelObj.name,labelObj.title)
}
let obj = {name:'sss',label:'',age:1,gender:'',title:'123'}
checkLabel(obj)
let obj1:labelValue = {label:'123',name:'111',title:'qqq'};
let arr:number[] = [],arr1:string[] = [];
interface SquareConfig {
color: string;
width?: number;
}
function createSquare(config: SquareConfig):string {
return config.color;
}
let mySquare = createSquare({ color: "red", width: 100 });
console.log('mySquar',mySquare)
class Person{
private name:string;
constructor(name:string){
this.name = name;
}
saySomething(){
console.log(this.name)
}
}
class shirley extends Person{
saySomething(){
console.log('shirley')
}
}
class person extends shirley{}
let lixian = new shirley('lixian');
lixian.saySomething();