@@ -46,7 +46,6 @@ to maintain.
46
46
* [ ` toHaveTextContent ` ] ( #tohavetextcontent )
47
47
* [ ` toHaveAttribute ` ] ( #tohaveattribute )
48
48
* [ ` toHaveClass ` ] ( #tohaveclass )
49
- * [ Using with Typescript] ( #using-with-typescript )
50
49
* [ Inspiration] ( #inspiration )
51
50
* [ Other Solutions] ( #other-solutions )
52
51
* [ Guiding Principles] ( #guiding-principles )
@@ -84,6 +83,9 @@ import {toBeInTheDOM, toHaveClass} from 'jest-dom'
84
83
expect .extend ({toBeInTheDOM, toHaveClass})
85
84
```
86
85
86
+ > Note: when using TypeScript, this way of importing matchers won't provide the
87
+ > necessary type definitions. More on this [ here] ( https://github.com/gnapse/jest-dom/pull/11#issuecomment-387817459 ) .
88
+
87
89
## Custom matchers
88
90
89
91
### ` toBeInTheDOM `
@@ -161,23 +163,6 @@ expect(getByTestId(container, 'delete-button')).not.toHaveClass('btn-link')
161
163
// ...
162
164
```
163
165
164
- ### Using with Typescript
165
-
166
- When you use custom Jest Matchers with Typescript, you can extend ` jest.Matchers `
167
- interface provided by ` @types/jest ` package by creating ` .d.ts ` file somewhere
168
- in your project with following content:
169
-
170
- ``` typescript
171
- declare namespace jest {
172
- interface Matchers <R > {
173
- toHaveAttribute: (attr : string , value ? : string ) => R
174
- toHaveTextContent: (htmlElement : string ) => R
175
- toHaveClass: (className : string ) => R
176
- toBeInTheDOM: () => R
177
- }
178
- }
179
- ```
180
-
181
166
## Inspiration
182
167
183
168
This whole library was extracted out of Kent C. Dodds' [ dom-testing-library] [ ] ,
0 commit comments