@@ -57,11 +57,11 @@ export interface NodeOp {
57
57
let nodeId : number = 0
58
58
let recordedNodeOps : NodeOp [ ] = [ ]
59
59
60
- export function logNodeOp ( op : NodeOp ) {
60
+ export function logNodeOp ( op : NodeOp ) : void {
61
61
recordedNodeOps . push ( op )
62
62
}
63
63
64
- export function resetOps ( ) {
64
+ export function resetOps ( ) : void {
65
65
recordedNodeOps = [ ]
66
66
}
67
67
@@ -128,7 +128,7 @@ function createComment(text: string): TestComment {
128
128
return node
129
129
}
130
130
131
- function setText ( node : TestText , text : string ) {
131
+ function setText ( node : TestText , text : string ) : void {
132
132
logNodeOp ( {
133
133
type : NodeOpTypes . SET_TEXT ,
134
134
targetNode : node ,
@@ -137,7 +137,11 @@ function setText(node: TestText, text: string) {
137
137
node . text = text
138
138
}
139
139
140
- function insert ( child : TestNode , parent : TestElement , ref ?: TestNode | null ) {
140
+ function insert (
141
+ child : TestNode ,
142
+ parent : TestElement ,
143
+ ref ?: TestNode | null ,
144
+ ) : void {
141
145
let refIndex
142
146
if ( ref ) {
143
147
refIndex = parent . children . indexOf ( ref )
@@ -166,7 +170,7 @@ function insert(child: TestNode, parent: TestElement, ref?: TestNode | null) {
166
170
}
167
171
}
168
172
169
- function remove ( child : TestNode , logOp = true ) {
173
+ function remove ( child : TestNode , logOp = true ) : void {
170
174
const parent = child . parentNode
171
175
if ( parent ) {
172
176
if ( logOp ) {
@@ -188,7 +192,7 @@ function remove(child: TestNode, logOp = true) {
188
192
}
189
193
}
190
194
191
- function setElementText ( el : TestElement , text : string ) {
195
+ function setElementText ( el : TestElement , text : string ) : void {
192
196
logNodeOp ( {
193
197
type : NodeOpTypes . SET_ELEMENT_TEXT ,
194
198
targetNode : el ,
@@ -228,11 +232,23 @@ function querySelector(): never {
228
232
throw new Error ( 'querySelector not supported in test renderer.' )
229
233
}
230
234
231
- function setScopeId ( el : TestElement , id : string ) {
235
+ function setScopeId ( el : TestElement , id : string ) : void {
232
236
el . props [ id ] = ''
233
237
}
234
238
235
- export const nodeOps = {
239
+ export const nodeOps : {
240
+ insert : typeof insert
241
+ remove : typeof remove
242
+ createElement : typeof createElement
243
+ createText : typeof createText
244
+ createComment : typeof createComment
245
+ setText : typeof setText
246
+ setElementText : typeof setElementText
247
+ parentNode : typeof parentNode
248
+ nextSibling : typeof nextSibling
249
+ querySelector : typeof querySelector
250
+ setScopeId : typeof setScopeId
251
+ } = {
236
252
insert,
237
253
remove,
238
254
createElement,
0 commit comments