INNER CODE UNIT · TypeScript
params
acro5piano/typed-graphqlify · src/graphqlify.ts:85
export function params<T>(params: Params, input: T): T {
if (typeof params !== 'object') {
throw new Error('Params have to be an object')
}
if (typeof input !== 'object') {
throw new Error(`Cannot apply params to JS ${typeof params}`)
}
;(input as any)[paramsSymbol] = params
return input
}
/**
* Use `alias` to write GraphQL alias. It should be placed as a dynamic property.
*
* ```graphql
* query getMaleUser {
* maleUser: user {