i have an issue whit the typegraphql, I try to do a BaseResolver that can have a base CRUD operations whit typeorm but when i compile the protect whit ts node i don't get the arguments of there resolvers query/mutation, instead the arguments show and then disappear after a couple of seconds of compile this is my code.
export function CreateBaseResolver<X extends ClassType, T extends ClassType>
(
Suffix: string,
ReturnEntity: T,
BaseInput: X,
Entity: any,
)
{
@Resolver({ isAbstract: true })
abstract class BaseResolver
{
@Mutation(() => [ReturnEntity], { name: `PostOne${Suffix}` })
async PostOne(@Arg('Data', () => BaseInput) Data: any)
{
//Make logic
}
}
return BaseResolver;
}
this is the normal resolver
@InputType()
export class ProductInput
{
@Field()
Id_Product: number;
}
const ProductBaseResolver = CreateBaseResolver('Product', Product, ProductInput, Product);
@Resolver(Product)
export class ProductResolver extends ProductBaseResolver
{
}
i found this in the issues of github https://github.com/MichalLytek/type-graphql/issues/55
it seems like we need to compile the typescript whit babel, but i use ts node in my case, try to do it whit babel but get the same error and i don't have parameters in my resolver, if anyone has this issue please i really appreciate an example of how to do it whit babel i will give mi pakaje.json info bellow
"scripts": {
"watch": "tsc -w",
"dev": "nodemon dist/index.js",
"start": "node dist/index.js",
"prestart": "ts-node src/index.ts"
},