/*
 * @Author: Kane
 * @Date: 2023-02-10 15:08:53
 * @LastEditors: Kane
 * @LastEditTime: 2023-02-13 10:04:33
 * @FilePath: /后端辅助工具/src/DataType/DataType.ts
 * @Description: 
 * 
 * Copyright (c) ${2022} by Kane, All Rights Reserved. 
 */
/*eslint no-unused-vars: "off" */
/*eslint @typescript-eslint/no-unused-vars: "off" */


//Tuple
function dataTypes()
{
    const tu: readonly [number, number, number] = [1, 1, 2,];

    const toArray: [number, number, string] = [1, 2, "3",];
    const v1: (number | string)[] = toArray;

    const s1 = "string";

    console.log(typeof s1);


    let point: {
        x: number,
        y: number,
    };
    point = { x: 0, y: 0, };

    function addOne(x: number, y: number = 1): number
    {
        return x + y;
    }

    console.log(addOne(1));

    function allParams(x: number, y: number): void 
    {
        const z = x + y;
    }

    //剩余参数，数组形式
    function overplusArgusWithArray(x: number, ...argus: number[]): number
    {
        return argus.length;
    }

    function overplusArugsWithTuple(x: number, ...argus: [number, number, string]): number
    {

        console.log(`元组形式的参数表${argus},剩余参数的数量${argus.length}。`);
        console.log(argus[2]);

        return argus.length;
    }

    overplusArugsWithTuple(1, 2, 3, "test");

    console.log(overplusArgusWithArray(1, 2, 3, 4, 5, 6, 7, 8, 9, 10));

    //测试null
    const nulltest: null = null;
    let var_2: { x: string; } = { x: "test", };

    // var_2 = null;
}


export default dataTypes;