معرفی شرکت ها


tsd-check-0.6.0


Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر
Card image cap
تبلیغات ما

مشتریان به طور فزاینده ای آنلاین هستند. تبلیغات می تواند به آنها کمک کند تا کسب و کار شما را پیدا کنند.

مشاهده بیشتر

توضیحات

Check TypeScript type definitions
ویژگی مقدار
سیستم عامل -
نام فایل tsd-check-0.6.0
نام tsd-check
نسخه کتابخانه 0.6.0
نگهدارنده ['samverschueren']
ایمیل نگهدارنده ['sam.verschueren@gmail.com']
نویسنده Sam Verschueren
ایمیل نویسنده sam.verschueren@gmail.com
آدرس صفحه اصلی git+https://github.com/SamVerschueren/tsd-check.git
آدرس اینترنتی https://github.com/SamVerschueren/tsd-check#readme
مجوز MIT
# tsd-check [![Build Status](https://travis-ci.org/SamVerschueren/tsd-check.svg?branch=master)](https://travis-ci.org/SamVerschueren/tsd-check) > Check TypeScript type definitions ## Install ``` $ npm install tsd-check ``` ## Usage Let's assume we wrote a `index.d.ts` type definition for our concat module. ```ts declare const concat: { (value1: string, value2: string): string; (value1: number, value2: number): string; }; export default concat; ``` In order to test this definition, add a `index.test-d.ts` file. ```ts import concat from '.'; concat('foo', 'bar'); concat(1, 2); ``` Running `npx tsd-check` as a command will verify that the type definition works correctly. Let's add some extra [assertions](#assertions). We can assert the return type of our function call to match a certain type. ```ts import {expectType} from 'tsd-check'; import concat from '.'; expectType<string>(concat('foo', 'bar')); expectType<string>(concat(1, 2)); ``` The `tsd-check` command will succeed again. We change our implementation and type definition to return a `number` when both inputs are of type `number`. ```ts declare const concat: { (value1: string, value2: string): string; (value1: number, value2: number): number; }; export default concat; ``` If we don't change the test file and we run the `tsd-check` command again, the test will fail. <img src="screenshot.png" width="1330"> ### Top-level `await` If your method returns a `Promise`, you can use top-level `await` to resolve the value instead of wrapping it in an `async` [IIFE](https://developer.mozilla.org/en-US/docs/Glossary/IIFE). ```ts import {expectType, expectError} from 'tsd-check'; import concat from '.'; expectType<Promise<string>>(concat('foo', 'bar')); expectType<string>(await concat('foo', 'bar')); expectError(await concat(true, false)); ``` ### Test directory When you have spread your tests over multiple files, you can store all those files in a test directory called `test-d`. If you want to use another directory name, you can change it in `package.json`. ```json { "name": "my-module", "tsd-check": { "directory": "my-test-dir" } } ``` Now you can put all your test files in the `my-test-dir` directory. ## Assertions ### expectType&lt;T&gt;(value) Check if a value is of a specific type. ### expectError(function) Check if the function call has argument type errors. ### expectError&lt;T&gt;(value) Check if a value is of the provided type `T`. ## License MIT © [Sam Verschueren](https://github.com/SamVerschueren)


نیازمندی

مقدار نام
^1.3.0 eslint-formatter-pretty
^9.1.0 globby
^5.0.0 meow
^3.0.0 path-exists
^4.0.0 read-pkg-up
^3.0.1 typescript
^2.5.0 update-notifier


زبان مورد نیاز

مقدار نام
10.15.1 Npm


نحوه نصب


نصب پکیج tgz tsd-check-0.6.0:

    npm install tsd-check-0.6.0.tgz