# ts基础
## `interface`接口定义
1. 用来更好的定义数据集合,为每一项进行准确的定义
2. 用法
   1. 用`interface`定义必须包含`label`属性,并且值类型为`string`
    ```typescript

    interface LabelledValue {
    label: string;
    }

    function printLabel(labelledObj: LabelledValue) {
    console.log(labelledObj.label);
    }

    let myObj = {size: 10, label: "Size 10 Object"};
    printLabel(myObj);

    ```