Skip to content

Commit

Permalink
Merge pull request #4 from yokuze/add_typescript_types_3
Browse files Browse the repository at this point in the history
Fixes #3 Add TypeScript support
  • Loading branch information
jthomerson committed Feb 5, 2019
2 parents 1225e76 + 11953a8 commit dff5157
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
11 changes: 10 additions & 1 deletion README.md
Expand Up @@ -25,12 +25,21 @@ our codebase.

## How do I use it?

```
```js
var chai = require('chai');

chai.use(require('@silvermine/chai-strictly-equal'));
```

Or, if you are using TypeScript:

```typescript
import chai from 'chai';
import enableStrictlyEqual from '@silvermine/chai-strictly-equal';

chai.use(enableStrictlyEqual);
```

That's all there is to it. Then your `.equal` calls will throw an error, indicating that
you should replace them with `.eql` or `.strictlyEqual`.

Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.0",
"description": "Chai assertion library plugin to add `strictlyEqual` function and disable `equal`",
"main": "src/index.js",
"types": "./types/index.d.ts",
"scripts": {
"test": "./node_modules/.bin/istanbul cover --root src --include-all-sources ./node_modules/.bin/_mocha -- -R spec 'tests/**/*.test.js'"
},
Expand Down
11 changes: 11 additions & 0 deletions types/index.d.ts
@@ -0,0 +1,11 @@
declare global {
export namespace Chai {
export interface Assertion {
strictlyEqual(value: any, message?: string): void;
}
}
}

declare const enableStrictlyEqual: (chai: any, util: any) => void;

export = enableStrictlyEqual;

0 comments on commit dff5157

Please sign in to comment.