當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。