it is currently possible to register a Field onto a class at runtime, by invoking manually like this:
const decoratorFunction = Field({
type,
name: relationName,
isNullable
})
decoratorFunction(prototype, fieldName)
however this is not possible with Arg because for dynamically created method, we don't have any metadata. The compileFieldArgs doesn't register any arguments, because calling
var inferedRawArgs = Reflect.getMetadata('design:paramtypes', target.prototype, fieldName);
obviously returns undefined and the whole compileFieldArgs function just returns without doing anything more.
It would be great If we could have some kind of
{registerDynamicArgument} from 'typegql'
registerDynamicArgument(myClass, "myMethod", "myArgumentName", {
isNullable: true,
type: String
})
it is currently possible to register a
Fieldonto a class at runtime, by invoking manually like this:however this is not possible with
Argbecause for dynamically created method, we don't have any metadata. ThecompileFieldArgsdoesn't register any arguments, because callingobviously returns undefined and the whole
compileFieldArgsfunction just returns without doing anything more.It would be great If we could have some kind of