File tree 1 file changed +3
-9
lines changed
1 file changed +3
-9
lines changed Original file line number Diff line number Diff line change @@ -44,22 +44,16 @@ const logTestingPlaygroundURL = (element = getDocument().body) => {
44
44
)
45
45
}
46
46
47
- const initialValue : {
48
- [ key in keyof typeof queries | 'debug' | 'logTestingPlaygroundURL' ] ?: Function
49
- } = { debug, logTestingPlaygroundURL}
47
+ const initialValue = { debug, logTestingPlaygroundURL}
50
48
51
49
export const screen =
52
50
typeof document !== 'undefined' && document . body // eslint-disable-line @typescript-eslint/no-unnecessary-condition
53
51
? getQueriesForElement ( document . body , queries , initialValue )
54
- : typedKeysOf ( queries ) . reduce < typeof initialValue > ( ( helpers , key ) => {
55
- helpers [ key ] = ( ) => {
52
+ : Object . keys ( queries ) . reduce ( ( helpers , key ) => {
53
+ helpers [ key as keyof typeof initialValue ] = ( ) => {
56
54
throw new TypeError (
57
55
'For queries bound to document.body a global document has to be available... Learn more: https://testing-library.com/s/screen-global-error' ,
58
56
)
59
57
}
60
58
return helpers
61
59
} , initialValue )
62
-
63
- function typedKeysOf < O extends Object > ( o : O ) {
64
- return Object . keys ( o ) as Array < keyof O >
65
- }
You can’t perform that action at this time.
0 commit comments