File tree Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Expand file tree Collapse file tree 3 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -123,8 +123,17 @@ export function handler<E, T>(
123123 handler ?: ( event : E , props : T ) => any ,
124124) : HandlerFactory < T , E > {
125125 if ( typeof eventSchema === "function" ) {
126- handler = eventSchema ;
127- eventSchema = stateSchema = undefined ;
126+ if (
127+ stateSchema && typeof stateSchema === "object" &&
128+ "proxy" in stateSchema && stateSchema . proxy === true
129+ ) {
130+ handler = eventSchema ;
131+ eventSchema = stateSchema = undefined ;
132+ } else {
133+ throw new Error (
134+ "invalid handler, no schema provided - did you forget to enable CTS?" ,
135+ ) ;
136+ }
128137 }
129138
130139 const schema : JSONSchema | undefined = eventSchema || stateSchema
Original file line number Diff line number Diff line change @@ -100,6 +100,7 @@ describe("module", () => {
100100 props . x = event . clientX ;
101101 props . y = event . clientY ;
102102 } ,
103+ { proxy : true } ,
103104 ) ;
104105 expect ( typeof clickHandler ) . toBe ( "function" ) ;
105106 expect ( isModule ( clickHandler ) ) . toBe ( true ) ;
@@ -111,6 +112,7 @@ describe("module", () => {
111112 props . x = event . clientX ;
112113 props . y = event . clientY ;
113114 } ,
115+ { proxy : true } ,
114116 ) ;
115117 const stream = clickHandler ( { x : opaqueRef ( 10 ) , y : opaqueRef ( 20 ) } ) ;
116118 expect ( isOpaqueRef ( stream ) ) . toBe ( true ) ;
@@ -201,6 +203,7 @@ describe("module", () => {
201203 props . x = event . clientX ;
202204 props . y = event . clientY ;
203205 } ,
206+ { proxy : true } ,
204207 ) ;
205208 const stream = clickHandler . with ( { x : opaqueRef ( 10 ) , y : opaqueRef ( 20 ) } ) ;
206209 expect ( isOpaqueRef ( stream ) ) . toBe ( true ) ;
Original file line number Diff line number Diff line change 1+ /// <cts-enable />
12import {
23 Cell ,
34 derive ,
You can’t perform that action at this time.
0 commit comments