@@ -148,6 +148,7 @@ describe('In-page script channel', () => {
148148 describe ( 'Function calling' , ( ) => {
149149 it ( 'types fire-and-forget calls to panel functions' , ( ) => {
150150 expectTypeOf ( channel . emit ( 'notify' , 'ready' ) ) . toEqualTypeOf < void > ( )
151+ expectTypeOf ( channel . callEvent ( 'notify' , 'ready' ) ) . toEqualTypeOf < void > ( )
151152
152153 // @ts -expect-error In-page script functions cannot be called on panels.
153154 channel . emit ( 'echo' , 'ready' )
@@ -159,6 +160,19 @@ describe('In-page script channel', () => {
159160 channel . emit ( 'notify' , 'ready' , 'extra' )
160161 } )
161162
163+ it ( 'rejects fire-and-forget calls to panel queries' , ( ) => {
164+ const mixedChannel = createPageScriptChannel < MixedPanelProtocol > ( {
165+ name : 'devframes:mixed-panel' ,
166+ functions : { } ,
167+ } )
168+
169+ mixedChannel . emit ( 'notify' , 'ready' )
170+ // @ts -expect-error Queries cannot be emitted as events.
171+ mixedChannel . emit ( 'confirm' , 'continue?' )
172+ // @ts -expect-error The deprecated alias has the same event-only contract.
173+ mixedChannel . callEvent ( 'confirm' , 'continue?' )
174+ } )
175+
162176 it ( 'types calls to connected panels' , ( ) => {
163177 const panel = channel . panels [ 0 ] !
164178
@@ -330,16 +344,19 @@ describe('Panel channel', () => {
330344 } )
331345
332346 it ( 'types fire-and-forget calls to in-page script functions' , ( ) => {
333- expectTypeOf ( channel . emit ( 'echo' , 'hello' ) ) . toEqualTypeOf < void > ( )
334- expectTypeOf ( channel . emit ( 'sum' , 1 , 2 ) ) . toEqualTypeOf < void > ( )
335347 expectTypeOf ( channel . emit ( 'save' , 'draft' ) ) . toEqualTypeOf < void > ( )
348+ expectTypeOf ( channel . callEvent ( 'save' , 'draft' ) ) . toEqualTypeOf < void > ( )
336349
337350 // @ts -expect-error Panel functions cannot be emitted to the in-page script.
338351 channel . emit ( 'notify' , 'hello' )
339- // @ts -expect-error `echo` requires a string.
340- channel . emit ( 'echo' , false )
341- // @ts -expect-error `sum` requires two arguments.
342- channel . emit ( 'sum' , 1 )
352+ // @ts -expect-error Queries cannot be emitted as events.
353+ channel . emit ( 'echo' , 'hello' )
354+ // @ts -expect-error Queries cannot be emitted as events.
355+ channel . emit ( 'sum' , 1 , 2 )
356+ // @ts -expect-error `save` requires a string.
357+ channel . emit ( 'save' , false )
358+ // @ts -expect-error The deprecated alias has the same event-only contract.
359+ channel . callEvent ( 'echo' , 'hello' )
343360 } )
344361
345362 it ( 'types channel state' , ( ) => {
0 commit comments