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


TypeScript tsd-check.expectType函数代码示例

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


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

示例1: it

 it('should accept filters with values', () => {
     const s = create({
         type: 'item', columns: ['created'],
         filters: [{
             name: 'isinactive',
             operator: Operator.IS,
             values: 'F'
         }]
     });
     expectType<Search>(s);
 });
开发者ID:headintheclouddev,项目名称:typings-suitescript-2.0,代码行数:11,代码来源:searchTypeCheck.ts

示例2: withTimeout

import { expectType } from 'tsd-check';
import Queue, { Options, QueueWorker, QueueWorkerCallback } from '.'

expectType<Options>({});
expectType<Options>({ concurrency: 0 });
expectType<Options>({ timeout: 0 });
expectType<Options>({ autostart: true });
expectType<Options>({ results: [0, 'a', true, undefined, NaN] });

expectType<QueueWorker>(() => undefined);
expectType<QueueWorker>((callback: QueueWorkerCallback) => undefined);

function withTimeout() { }
withTimeout.timeout = 1;

expectType<QueueWorker>(withTimeout);

expectType<QueueWorkerCallback>(() => undefined);
expectType<QueueWorkerCallback>((data: Error) => undefined);
expectType<QueueWorkerCallback>((error: Error) => undefined);
expectType<QueueWorkerCallback>((error: Error, data: Object) => undefined);

expectType<Queue>(Queue());
expectType<Queue>(Queue({}));
expectType<Queue>(Queue({ concurrency: 0, timeout: 0, autostart: true, results: [] }));
expectType<Queue>(new Queue());
expectType<Queue>(new Queue({}));
expectType<Queue>(new Queue({ concurrency: 0, timeout: 0, autostart: true, results: [] }));

const q: Queue = Queue();
开发者ID:jessetane,项目名称:queue,代码行数:30,代码来源:index.test-d.ts

示例3:

import {expectType} from 'tsd-check';
import stripAnsi from '.';

expectType<string>(stripAnsi('\u001B[4mcake\u001B[0m'));
开发者ID:chalk,项目名称:strip-ansi,代码行数:4,代码来源:index.test-d.ts

示例4:

import {expectType} from 'tsd-check';
import {isNpm} from '.';

expectType<boolean>(isNpm);
开发者ID:sindresorhus,项目名称:is-npm,代码行数:4,代码来源:index.test-d.ts

示例5:

import {expectType} from 'tsd-check';
import select from '.';

// `select-dom` defaults to HTMLElement where possible
// because it's the most common use case, even if
// technically this should not be HTMLElement.

/**
 * SELECT
 */
expectType<null>(select('.wow'));
expectType<Element>(select('.wow'));
expectType<HTMLElement>(select('.wow'));
expectType<HTMLAnchorElement>(select<HTMLAnchorElement>('.wow'));

expectType<HTMLElement>(select('base'));
expectType<HTMLBaseElement>(select('base'));

expectType<SVGElement>(select('g'));
expectType<SVGGElement>(select('g'));

/**
 * EXISTS
 */
expectType<boolean>(select.exists('.wow'));
expectType<boolean>(select.exists('base'));
expectType<boolean>(select.exists('g'));

/**
 * ALL
 */
开发者ID:bfred-it,项目名称:select-dom,代码行数:31,代码来源:index.test-d.ts


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