Looked at examples on how to write type for currying functions, but I still can’t connect the two.
This is the function I have for my resolver
export default {
Query: {
Name: getResolver(‘name’, ‘special’)
}
}
function getResolver(n: string, type: string) {
return (parent, args, ctx) => { ... }
}
I try to do this but it does not work.
type GetResolver = <t, t1, t2>() => (parent: t...) => ...
and
type NameResolver = (t, t1, t2)=> ...
type GetResolver = (...) => NameResolver
I know those types are wrong, but I am not sure what is missing here.
How do we write type for graphql resolver functions?
getNameResolver(n, type),nandtypewhat do they stand for? More context is needed to answer your question. - hackapenandtypeare keys we use to locate specific data. for example loader[type][n] to retrieve a value, and for each of the type, it returns a different type. for example special expects to return string, while junk to return number - roger