Skip to content

Commit bc970a5

Browse files
authored
Revert "without CTS, our types allow invalid handler (#1551)" (#1568)
This reverts commit 2b7fa35.
1 parent bf52d1c commit bc970a5

File tree

3 files changed

+2
-15
lines changed

3 files changed

+2
-15
lines changed

packages/runner/src/builder/module.ts

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,8 @@ export function handler<E, T>(
123123
handler?: (event: E, props: T) => any,
124124
): HandlerFactory<T, E> {
125125
if (typeof eventSchema === "function") {
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-
}
126+
handler = eventSchema;
127+
eventSchema = stateSchema = undefined;
137128
}
138129

139130
const schema: JSONSchema | undefined = eventSchema || stateSchema

packages/runner/test/module.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ describe("module", () => {
100100
props.x = event.clientX;
101101
props.y = event.clientY;
102102
},
103-
{ proxy: true },
104103
);
105104
expect(typeof clickHandler).toBe("function");
106105
expect(isModule(clickHandler)).toBe(true);
@@ -112,7 +111,6 @@ describe("module", () => {
112111
props.x = event.clientX;
113112
props.y = event.clientY;
114113
},
115-
{ proxy: true },
116114
);
117115
const stream = clickHandler({ x: opaqueRef(10), y: opaqueRef(20) });
118116
expect(isOpaqueRef(stream)).toBe(true);
@@ -203,7 +201,6 @@ describe("module", () => {
203201
props.x = event.clientX;
204202
props.y = event.clientY;
205203
},
206-
{ proxy: true },
207204
);
208205
const stream = clickHandler.with({ x: opaqueRef(10), y: opaqueRef(20) });
209206
expect(isOpaqueRef(stream)).toBe(true);

recipes/simpleValue.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
/// <cts-enable />
21
import {
32
Cell,
43
derive,

0 commit comments

Comments
 (0)