Skip to content

Commit 84a40ad

Browse files
committed
Clean up ThrowError type in errorHook tests
1 parent f0d080e commit 84a40ad

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

test/errorHook.ts

+4-5
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
11
import { useState, useEffect } from 'react'
22
import { renderHook } from '../src'
33

4-
type throwError = Error | boolean | undefined
54
describe('error hook tests', () => {
6-
function useError(throwError: throwError) {
5+
function useError(throwError: boolean) {
76
if (throwError) {
87
throw new Error('expected')
98
}
109
return true
1110
}
1211

13-
function useAsyncError(throwError: throwError) {
14-
const [value, setValue] = useState<throwError>()
12+
function useAsyncError(throwError: boolean) {
13+
const [value, setValue] = useState<boolean>()
1514
useEffect(() => {
1615
const timeout = setTimeout(() => setValue(throwError), 100)
1716
return () => clearTimeout(timeout)
1817
}, [throwError])
1918
return useError(value)
2019
}
2120

22-
function useEffectError(throwError: throwError) {
21+
function useEffectError(throwError: boolean) {
2322
useEffect(() => {
2423
useError(throwError)
2524
}, [throwError])

0 commit comments

Comments
 (0)