Skip to content

Commit 8218ee0

Browse files
committed
feat(typings): add ts definitions
1 parent df3df4a commit 8218ee0

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

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

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

0 commit comments

Comments
 (0)