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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(core/types): export hooks function types #9129
feat(core/types): export hooks function types #9129
Conversation
fab3cee
to
f232dee
Compare
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 37f568f:
|
fab3cee
to
e90b963
Compare
e90b963
to
37f568f
Compare
@@ -14,9 +9,9 @@ type CommonArgs<ListTypeInfo extends BaseListTypeInfo> = { | |||
listKey: ListTypeInfo['key'] | |||
} | |||
|
|||
type ResolveInputListHook< | |||
export type ResolveInputListHook< |
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.
Why did you need the Resolve*
types?
) => MaybePromise<void> | ||
|
||
type BeforeOperationListHook< | ||
export type BeforeOperationListHook< |
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.
Why not use Lists.Post['hooks']['beforeOperation']
as the type in your project? [assumes a Post
list]
Where Lists
is from import { type Lists } from '.keystone/types'
I am personally hesitant about this, as I think we should be promoting the usage of the refined, generated types, not these abstract types. Maybe we can add additional exports to the refined types if something like |
Hey, @dcousens, I understand your point. In my case, I need only the args type of the Will close this PR for now (while rethinking how to use it the right way) PS: Our project requirements started diverging from KS's base functionalities. |
@iamandrewluca no problem, and thanks for the contributions!
Let me know if any examples could better help demonstrate how you could use the refined types in an abstract way |
It would be better to have the hooks function types exported from KS.
PR is in 2 commits. One formats the changed code, one does the actual changes.
Today, I had to write some code and reuse some KS types that are not exported directly but through the API. It was complicated, but I did it.
See the code 馃檲