#help me type this function

11 messages · Page 1 of 1 (latest)

hazy harness
#

I have this type: QueryResolvers['user']
I need some help to type this function:

const objectHandler = fn => (parent, args, context, info) => Promose
  .resolve(fn(parent, args, context, info))
  .catch(handleErrors)

fn is of type QueryResolvers['user']

the arguments (parent, args, context, info) are the same like the arguments of QueryResolvers['user']`

signal citrus
#

(fn: QueryResolvers['user']) => (...[parent, args, context, info]: Parameters<QueryResolvers['user']>)

#

maybe?

hazy harness
#

let me give it a try 🙂

lusty bison
hazy harness
#

have to make it a bit cleaner

lusty bison
hazy harness
lusty bison
#

!resolved

raven lichenBOT
#

@hazy harness
Because your issue seemed to be resolved, this post was marked as resolved by @lusty bison.
If your issue is not resolved, you can reopen this post by running !reopen.
If you have a different question, make a new post in #1057653400046674112.

signal citrus
#

yeah, unfortunately if you have to manipulate types i dont think theres a better way