MichalLytek / type-graphql

Create GraphQL schema and resolvers with TypeScript, using classes and decorators!
https://typegraphql.com
MIT License
7.98k stars 674 forks source link

Important Update: Changes in Resolver Configuration #1715

Closed marcoswebmasteroficial closed 5 days ago

marcoswebmasteroficial commented 6 days ago

Previously, you could configure resolvers as shown below:

const schema = await buildSchema({ resolvers: [path.resolve(__dirname, 'src', 'resolvers', '*.ts')], emitSchemaFile: path.resolve(__dirname, 'schema.gql') })

However, recent updates in versions and dependencies have introduced changes in how resolvers are configured, impacting the typing in type BuildSchemaOptions.

before they were resolvers: NonEmptyArray<Function> | NonEmptyArray<string>; Now are resolvers: NonEmptyArray<Function>;

I would like to use it as it used to be very good

MichalLytek commented 5 days ago

It's not possible, it was keep for 1.x compatibility reason and won't be supported in 2.0.

You need to implement your own code/function responsible for translating glob string into an array of resolvers classes. It may also require special tricks depending if you use some bundler or not.