Skip to content

How to get resolveInput type when extracting hook? #8460

Answered by asgeo1
ttbarnes asked this question in Questions
Discussion options

You must be logged in to vote

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 Session class, then you would do FieldHooks<Lists.Product.TypeInfo<Session>>['resolveInput']

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by dcousens
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants