You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix: allow Data to be inferred from Handler function (#2916)
This PR adds support for single-function GET handler data to be inferred
when using `define.page<typeof handler>()`.
```ts
export const handler = define.handlers((ctx) => {
return page({ foo: "foo" });
});
export default define.page<typeof handler>((ctx) => {
ctx.data; // Correctly resolves as { foo: string }
});
```
This PR also adds a test that checks that the types inferred are correct
by type checking.
0 commit comments