Skip to content

Commit 8fc30b2

Browse files
committed
throw error when trying to track non-existent property
1 parent 9aeddb8 commit 8fc30b2

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/document/interceptor.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ type Params<Prop> = Prop extends anyFunc ? Parameters<Prop> : [Prop]
1010
type ImplReturn<Prop> = Prop extends anyFunc ? Parameters<Prop> : Prop
1111

1212
export function prepareInterceptor<
13-
ElementType extends Node,
13+
ElementType extends Element,
1414
PropName extends keyof ElementType,
1515
>(
1616
element: ElementType,
@@ -43,7 +43,10 @@ export function prepareInterceptor<
4343
typeof prototypeDescriptor?.[target] !== 'function' ||
4444
(prototypeDescriptor[target] as Interceptable)[Interceptor]
4545
) {
46-
return
46+
/* istanbul ignore next */
47+
throw new Error(
48+
`Element ${element.tagName} does not implement "${String(propName)}".`,
49+
)
4750
}
4851

4952
function intercept(

0 commit comments

Comments
 (0)