typescript

function keepWholeObject(wholeObject: { a: string, b: number }) {
    let { a, b = 1001 } = wholeObject;
    console.log(a,b);
}
keepWholeObject({a:'1s',b:undefined});

Void

和‘any’相对的数据类型则是’Void‘,它代表没有任何数据类型。我们常用的一个方法没有任何返回值:

function warnUser(): void {
    alert("This is my warning message");
}
原文地址:https://www.cnblogs.com/l8l8/p/9717745.html