本文整理汇总了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);
});
示例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();
示例3:
import {expectType} from 'tsd-check';
import stripAnsi from '.';
expectType<string>(stripAnsi('\u001B[4mcake\u001B[0m'));
示例4:
import {expectType} from 'tsd-check';
import {isNpm} from '.';
expectType<boolean>(isNpm);
示例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
*/