{"id":49566,"library":"type-graphql-utils","title":"type-graphql-utils","description":"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.","status":"active","version":"2.1.0","language":"javascript","source_language":"en","source_url":"https://github.com/ChrisLahaye/type-graphql-utils","tags":["javascript","type-graphql","typescript"],"install":[{"cmd":"npm install type-graphql-utils","lang":"bash","label":"npm"},{"cmd":"yarn add type-graphql-utils","lang":"bash","label":"yarn"},{"cmd":"pnpm add type-graphql-utils","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for GraphQL type system utilities","package":"graphql","optional":false},{"reason":"Peer dependency required to access decorated class metadata","package":"type-graphql","optional":false}],"imports":[{"note":"Named export, not default export","wrong":"import Pick from 'type-graphql-utils'","symbol":"Pick","correct":"import { Pick } from 'type-graphql-utils'"},{"note":"CommonJS require works, but 'correct' shows ESM pattern","wrong":"const Partial = require('type-graphql-utils').Partial","symbol":"Partial","correct":"import { Partial } from 'type-graphql-utils'"},{"note":"","wrong":"","symbol":"Omit","correct":"import { Omit } from 'type-graphql-utils'"},{"note":"","wrong":"","symbol":"Required","correct":"import { Required } from 'type-graphql-utils'"}],"quickstart":{"code":"import { Field, InputType, ObjectType } from 'type-graphql';\nimport { Pick, Partial, Required } from 'type-graphql-utils';\n\n@ObjectType()\nclass User {\n  @Field()\n  id!: number;\n\n  @Field()\n  name!: string;\n\n  @Field()\n  email!: string;\n}\n\n@InputType()\nclass UserInput1 extends Partial(User) {}\n// Input fields: id (optional), name (optional), email (optional)\n\n@InputType()\nclass UserInput2 extends Pick(User, { name: 1 }) {}\n// Input field: name (required)\n\n@InputType()\nclass UserInput3 extends Required(Partial(User), { id: 1 }) {}\n// Input fields: id (required), name (optional), email (optional)","lang":"typescript","description":"Demonstrates Pick, Partial, and Required utilities to create InputType classes from an ObjectType."},"warnings":[{"fix":"Downgrade to graphql 15.x and type-graphql 1.x, or look for alternative libraries that support newer versions.","message":"Requires graphql ^15 and type-graphql ^1. Does not support graphql v16 or type-graphql v2.","severity":"breaking","affected_versions":">=2.0.0"},{"fix":"Always use object syntax: { field1: 1, field2: 1 }.","message":"The 'names' parameter must be an object with integer values equal to 1, e.g. { field: 1 }, not an array or other object shape.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Pass options object with directives: true when needed.","message":"'directives' option defaults to false; if your type-graphql classes use directives, they will be lost unless you pass { directives: true }.","severity":"gotcha","affected_versions":">=2.0.0"},{"fix":"Consider using native type-graphql utilities or migrating to TypeGraphQL v2 with class-transformer-validator.","message":"Library is no longer actively maintained; last release was in 2020.","severity":"deprecated","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1':70,90,93 '15':65 '2.1.0':16 'array':96 'caus':106 'class':51 'creat':49 'current':12 'decor':43,56 'default':103 'defin':38 'depend':63 'direct':98 'e.g':91 'fals':101 'field':54,92 'function':21 'graphql':3,10,33,42,64,69,74,79,113 'input':36 'issu':107 'javascript':110 'librari':18 'may':105 'metadata':59 'modifi':53 'must':84 'name':82 'new':50 'object':34,87 'omit':27,109 'oper':45 'option':99 'paramet':83 'partial':28 'peer':62 'pick':26 'pitfal':60 'preserv':55 'provid':19 'requir':30,61 'runtim':47 'similar':22 'stabl':13 'support':73 'transform':7 'type':2,9,11,37,41,58,68,78,112 'type-graphql':8,40,67,77,111 'type-graphql-util':1 'typescript':24,114 'util':4,5,20 'v16':75 'v2':80 'valu':89 'version':14","created_at":"2026-06-07T17:02:25.698149+00:00","updated_at":"2026-06-07T17:02:25.698149+00:00","problems":[{"fix":"Ensure 'reflect-metadata' is imported at the top of your entry file: import 'reflect-metadata';","cause":"Missing peer dependency 'reflect-metadata' or incorrect import order","error":"Uncaught TypeError: Cannot read properties of undefined (reading 'prototype')"},{"fix":"Install graphql: npm install graphql@15","cause":"Missing peer dependency graphql","error":"Error: Cannot find module 'graphql'\nRequire stack:\n- /node_modules/type-graphql-utils/dist/index.js"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/ChrisLahaye/type-graphql-utils","github":"https://github.com/ChrisLahaye/type-graphql-utils","docs":null,"changelog":null,"pypi":null,"npm":"type-graphql-utils","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}