Replies: 1 comment 1 reply
-
I can only see this working with generics, where your function accepts a |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hey all! I've implemented a custom type registry that contains all of the registered types to be able to use dependency injection and to have these types only be created once. Similar to how it's done in the documentation.
This means that I have a get method on the registry to get a type from the registry like this:
It's then used like this example where I create classes that provide all types and get the type registry injected to be able to use other types in the schema.
This creates a problem now that I've added PHPStan to the project tough since the "InputObjectType" only expects the fields to contain types that are of "Type&InputType" but the get method can return any number of types since it can contain any kind of output and input types.
Has anyone had a similar problem and how did you solve it? I would prefer to keep only the "get" method instead of creating different methods for each kind of type.
Beta Was this translation helpful? Give feedback.
All reactions