-
I'm trying to extract a // schema.ts
Product: {
fields: { ... },
hooks: {
resolveInput: async ({ context, operation, resolvedData }) => {
const result = await hooks.resolveInput({ context, operation, resolvedData });
return result
}
}
}
// hooks.resolveInput.ts
import { FieldHooks } from '@keystone-6/core/dist/declarations/src/types/config/hooks';
import { BaseListTypeInfo } from '@keystone-6/core/types';
const resolveInput = async ({ context, operation, resolvedData }: Parameters<NonNullable<FieldHooks<BaseListTypeInfo>['resolveInput']>>[0]) => {
if (operation === 'create') {
try {
// custom logic here
}
}
} How can I get the types working for an extracted There is a similar (resolved) discussion here: #7449, but I cannot see how the types for |
Beta Was this translation helpful? Give feedback.
Answered by
asgeo1
Sep 17, 2024
Replies: 1 comment
-
With latest Keystone 6, this should work import { FieldHooks } from '@keystone-6/core/types'
import type { Context, Lists } from '.keystone/types'
const resolveInput: FieldHooks<Lists.Product.TypeInfo>['resolveInput'] = async ({ context, operation, resolvedData }) => {
if (operation === 'create') {
try {
// custom logic here
}
}
} If you have a custom |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
dcousens
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With latest Keystone 6, this should work
If you have a custom
Session
class, then you would doFieldHooks<Lists.Product.TypeInfo<Session>>['resolveInput']