Skip to content

Commit

Permalink
[readme] add descriptions on how to write assertions for dtslint (Def…
Browse files Browse the repository at this point in the history
  • Loading branch information
BendingBender authored and mhegazy committed Aug 14, 2017
1 parent b992475 commit 879a32c
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,18 @@ If a `tslint.json` turns rules off, this is because that hasn't been fixed yet.

(To indicate that a lint rule truly does not apply, use `// tslint:disable rule-name` or better, `//tslint:disable-next-line rule-name`.)

To assert that an expression is of a given type, use `$ExpectType`. To assert that an expression causes a compile error, use `$ExpectError`.

```js
// $ExpectType void
f(1);

// $ExpectError
f("one");
```

For more details, see [dtslint](https://github.com/Microsoft/dtslint#write-tests) readme.

Test by running `npm run lint package-name` where `package-name` is the name of your package.
This script uses [dtslint](https://github.com/Microsoft/dtslint).

Expand Down

0 comments on commit 879a32c

Please sign in to comment.