当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript util.types类代码示例

本文整理汇总了TypeScript中util.types的典型用法代码示例。如果您正苦于以下问题:TypeScript types类的具体用法?TypeScript types怎么用?TypeScript types使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了types类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1:

					return r.cells.map((cell: Cell) => {
						const def: IXLSXSpecCell = {};
						const fmt = cell.getEffectiveNumFormat();
						if (fmt) {
							def.fmt = fmt.fmt;
							def.fmt_typ = fmt.fmt_type;
						}
						if (cell.typ) {
							def.typ = cell.typ;
						}
						if (cell.raw) {
							def.raw = cell.raw;
						}
						if (cell.raw && cell.val !== cell.raw) {
							def.val = cell.val;
							if (util.types.isDate(def.val)) {
								if (isValidDate(cell.val)) {
									def.val = cell.val.toISOString();
								} else {
									def.val = cell.val.toString();
								}
							}
						}
						return def;
					});
开发者ID:ffalt,项目名称:xlsx-extract,代码行数:25,代码来源:test.ts

示例2: Float32Array

    td.decode(new Float32Array(1));
    td.decode(new Float64Array(1));
    td.decode(new DataView(new Int8Array(1).buffer));
    td.decode(new ArrayBuffer(1));
    td.decode(null);
    td.decode(null, { stream: true });
    td.decode(new Int8Array(1), { stream: true });
    const decode: string = td.decode(new Int8Array(1));

    // util.TextEncoder()
    const te = new util.TextEncoder();
    const teEncoding: string = te.encoding;
    const teEncodeRes: Uint8Array = te.encode("TextEncoder");

    // util.types
    let b: boolean;
    b = util.types.isBigInt64Array(15);
    b = util.types.isBigUint64Array(15);
    b = util.types.isModuleNamespaceObject(15);

    // tslint:disable-next-line:no-construct ban-types
    const maybeBoxed: number | Number = new Number(1);
    if (util.types.isBoxedPrimitive(maybeBoxed)) {
        const boxed: Number = maybeBoxed;
    }
    const maybeBoxed2: number | Number = 1;
    if (!util.types.isBoxedPrimitive(maybeBoxed2)) {
        const boxed: number = maybeBoxed2;
    }
}
开发者ID:TeamworkGuy2,项目名称:DefinitelyTyped,代码行数:30,代码来源:util.ts

示例3: if

import "../node-tests";
import * as util from "util";

//////////////////////////////////////////////////////////
/// Global Tests : https://nodejs.org/api/global.html  ///
//////////////////////////////////////////////////////////
{
    {
        const hrtimeBigint: bigint = process.hrtime.bigint();
    }
}

//////////////////////////////////////////////////////////
/// Util Tests                                         ///
//////////////////////////////////////////////////////////
{
    {
        const value: BigInt64Array | BigUint64Array | number = [] as any;
        if (util.types.isBigInt64Array(value)) {
            // $ExpectType BigInt64Array
            const b = value;
        } else if (util.types.isBigUint64Array(value)) {
            // $ExpectType BigUint64Array
            const b = value;
        } else {
            // $ExpectType number
            const b = value;
        }
    }
}
开发者ID:ChaosinaCan,项目名称:DefinitelyTyped,代码行数:30,代码来源:node-tests.ts

示例4: Uint8Array

    td.decode(new Uint8Array(1));
    td.decode(new Uint16Array(1));
    td.decode(new Uint32Array(1));
    td.decode(new Uint8ClampedArray(1));
    td.decode(new Float32Array(1));
    td.decode(new Float64Array(1));
    td.decode(new DataView(new Int8Array(1).buffer));
    td.decode(new ArrayBuffer(1));
    td.decode(null);
    td.decode(null, { stream: true });
    td.decode(new Int8Array(1), { stream: true });
    const decode: string = td.decode(new Int8Array(1));

    // util.TextEncoder()
    const te = new util.TextEncoder();
    const teEncoding: string = te.encoding;
    const teEncodeRes: Uint8Array = te.encode("TextEncoder");

    // util.types

    // tslint:disable-next-line:no-construct ban-types
    const maybeBoxed: number | Number = new Number(1);
    if (util.types.isBoxedPrimitive(maybeBoxed)) {
        const boxed: Number = maybeBoxed;
    }
    const maybeBoxed2: number | Number = 1;
    if (!util.types.isBoxedPrimitive(maybeBoxed2)) {
        const boxed: number = maybeBoxed2;
    }
}
开发者ID:CNBoland,项目名称:DefinitelyTyped,代码行数:30,代码来源:util.ts


注:本文中的util.types类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。