Skip to content

Commit 213055a

Browse files
MikletKent C. Dodds
authored and
Kent C. Dodds
committed
feat(typings): add ts definitions (#7)
* feat(typings): add ts definitions * chore(contributors): add myself
1 parent 4e2a02a commit 213055a

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

.all-contributorsrc

+9
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,15 @@
3737
"contributions": [
3838
"code"
3939
]
40+
},
41+
{
42+
"login": "Miklet",
43+
"name": "Paweł Mikołajczyk",
44+
"avatar_url": "https://avatars2.githubusercontent.com/u/12592677?v=4",
45+
"profile": "https://github.com/Miklet",
46+
"contributions": [
47+
"code"
48+
]
4049
}
4150
]
4251
}

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
[![downloads][downloads-badge]][npmtrends]
1313
[![MIT License][license-badge]][license]
1414

15-
[![All Contributors](https://img.shields.io/badge/all_contributors-3-orange.svg?style=flat-square)](#contributors)
15+
[![All Contributors](https://img.shields.io/badge/all_contributors-4-orange.svg?style=flat-square)](#contributors)
1616
[![PRs Welcome][prs-badge]][prs]
1717
[![Code of Conduct][coc-badge]][coc]
1818

@@ -354,8 +354,8 @@ Thanks goes to these people ([emoji key][emojis]):
354354
<!-- ALL-CONTRIBUTORS-LIST:START - Do not remove or modify this section -->
355355

356356
<!-- prettier-ignore -->
357-
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub><b>Kent C. Dodds</b></sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/react-testing-library/commits?author=kentcdodds "Code") [📖](https://github.com/kentcdodds/react-testing-library/commits?author=kentcdodds "Documentation") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [⚠️](https://github.com/kentcdodds/react-testing-library/commits?author=kentcdodds "Tests") | [<img src="https://avatars1.githubusercontent.com/u/2430381?v=4" width="100px;"/><br /><sub><b>Ryan Castner</b></sub>](http://audiolion.github.io)<br />[📖](https://github.com/kentcdodds/react-testing-library/commits?author=audiolion "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/8008023?v=4" width="100px;"/><br /><sub><b>Daniel Sandiego</b></sub>](https://www.dnlsandiego.com)<br />[💻](https://github.com/kentcdodds/react-testing-library/commits?author=dnlsandiego "Code") |
358-
| :---: | :---: | :---: |
357+
| [<img src="https://avatars.githubusercontent.com/u/1500684?v=3" width="100px;"/><br /><sub><b>Kent C. Dodds</b></sub>](https://kentcdodds.com)<br />[💻](https://github.com/kentcdodds/react-testing-library/commits?author=kentcdodds "Code") [📖](https://github.com/kentcdodds/react-testing-library/commits?author=kentcdodds "Documentation") [🚇](#infra-kentcdodds "Infrastructure (Hosting, Build-Tools, etc)") [⚠️](https://github.com/kentcdodds/react-testing-library/commits?author=kentcdodds "Tests") | [<img src="https://avatars1.githubusercontent.com/u/2430381?v=4" width="100px;"/><br /><sub><b>Ryan Castner</b></sub>](http://audiolion.github.io)<br />[📖](https://github.com/kentcdodds/react-testing-library/commits?author=audiolion "Documentation") | [<img src="https://avatars0.githubusercontent.com/u/8008023?v=4" width="100px;"/><br /><sub><b>Daniel Sandiego</b></sub>](https://www.dnlsandiego.com)<br />[💻](https://github.com/kentcdodds/react-testing-library/commits?author=dnlsandiego "Code") | [<img src="https://avatars2.githubusercontent.com/u/12592677?v=4" width="100px;"/><br /><sub><b>Paweł Mikołajczyk</b></sub>](https://github.com/Miklet)<br />[💻](https://github.com/kentcdodds/react-testing-library/commits?author=Miklet "Code") |
358+
| :---: | :---: | :---: | :---: |
359359

360360
<!-- ALL-CONTRIBUTORS-LIST:END -->
361361

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"version": "0.0.0-semantically-released",
44
"description": "Simple and complete React DOM testing utilities that encourage good testing practices.",
55
"main": "dist/index.js",
6+
"typings": "typings/index.d.ts",
67
"engines": {
78
"node": ">=8",
89
"npm": ">=5"
@@ -25,6 +26,7 @@
2526
"license": "MIT",
2627
"dependencies": {},
2728
"devDependencies": {
29+
"@types/react-dom": "^16.0.4",
2830
"axios": "^0.18.0",
2931
"history": "^4.7.2",
3032
"kcd-scripts": "^0.36.1",
@@ -58,4 +60,4 @@
5860
"url": "https://github.com/kentcdodds/react-testing-library/issues"
5961
},
6062
"homepage": "https://github.com/kentcdodds/react-testing-library#readme"
61-
}
63+
}

typings/index.d.ts

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import {Simulate as ReactSimulate} from 'react-dom/test-utils'
2+
3+
interface RenderResult {
4+
container: HTMLDivElement
5+
unmount: VoidFunction
6+
queryByTestId: (id: string) => HTMLElement | null
7+
}
8+
9+
export function render(
10+
ui: React.ReactElement<any>,
11+
options?: {container: HTMLElement},
12+
): RenderResult
13+
14+
export function flushPromises(): Promise<void>
15+
16+
export const Simulate: typeof ReactSimulate

0 commit comments

Comments
 (0)