Skip to content

Commit 3059b67

Browse files
committed
feat(typings): add ts definitions
1 parent 4e2a02a commit 3059b67

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-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

+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)