Utilities to transform type-graphql types. Current stable version is 2.1.0. This library provides utility functions similar to TypeScript's Pick, Omit, Partial, and Required, but for GraphQL object and input types defined with type-graphql decorators. It operates at runtime to create new classes with modified fields, preserving decorators and type metadata. Pitfalls: requires peer dependencies graphql ^15 and type-graphql ^1; does not support graphql v16 or type-graphql v2; the 'names' parameter must be an object with value 1 (e.g. { field: 1 }) not an array; the 'directives' option is false by default and may cause issues if omitted.
npm install type-graphql-utilsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates Pick, Partial, and Required utilities to create InputType classes from an ObjectType.
Downgrade to graphql 15.x and type-graphql 1.x, or look for alternative libraries that support newer versions.
Always use object syntax: { field1: 1, field2: 1 }.Pass options object with directives: true when needed.
Consider using native type-graphql utilities or migrating to TypeGraphQL v2 with class-transformer-validator.
Ensure 'reflect-metadata' is imported at the top of your entry file: import 'reflect-metadata';
Install graphql: npm install graphql@15