New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: cast actions deeplink v2 #251
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@dalechyn is attempting to deploy a commit to the wevm Team on Vercel. A member of the Team first needs to authorize it. |
f4ff0a7
to
fba7054
Compare
c1b4ce5
to
1d78c23
Compare
src/types/routes.ts
Outdated
> | ||
} | ||
> = /* We enforce `options` parameter to not be partial for Cast Actions*/ | ||
M extends 'cast-action' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I would rather avoid this ternary. Can we instead make options
optional within the parameter definition itself if the method extends "cast-action"
?
(
path: P,
handler: H<...>,
...rest: (M extends 'cast-action' ? [options: RouteOptions<M>] : [options?: RouteOptions<M>])
): FrogBase<...>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
brilliant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
src/frog-base.tsx
Outdated
export type RouteOptions = Pick<FrogConstructorParameters, 'verify'> & { | ||
fonts?: ImageOptions['fonts'] | (() => Promise<ImageOptions['fonts']>) | ||
} | ||
export type RouteOptions<M extends string = string> = Pick< |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export type RouteOptions<M extends string = string> = Pick< | |
export type RouteOptions<method extends string = string> = Pick< |
We can conform to our convention of generics as we aren't working on the Hono type fork (types/routes.ts
) anymore
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
src/frog-base.tsx
Outdated
? { | ||
fonts?: ImageOptions['fonts'] | (() => Promise<ImageOptions['fonts']>) | ||
} | ||
: M extends 'cast-action' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
: M extends 'cast-action' | |
: M extends 'castAction' |
Would be good if it mapped to the casing of the method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
@@ -17,5 +17,5 @@ export function getRouteParameters<env extends Env, handler>( | |||
else middlewares.push(parameters[i]) | |||
} | |||
|
|||
return [parameters[0], middlewares, handler!, options ?? {}] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this diff intended? Previous implementation is correct, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it was intended, just fixed it with a more narrowed typing.
need to correct the docs here |
* feat: cast actions deeplink v2 * chore: changesets * docs: update * chore: update changesets * nit: drop console.log * refactor: apply changes from code review * docs: fix * docs: nit * docs: fix
I've set changesets to a minor bump as it is gonna break the API of
Button.AddCastAction
and is gonna require a user to pass the options as the third argument of the.castAction
handler.While being a breaking change, it is pretty easy to migrate it.