@graphql-codegen/typescript-resolvers 4.5.2-alpha-20250627115156-9c57b83a4553fcece2f9fa6d83a61efd06c03b16 → 4.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/cjs/visitor.js CHANGED
@@ -74,8 +74,9 @@ class TypeScriptResolversVisitor extends visitor_plugin_common_1.BaseResolversVi
74
74
  return `{ ${(node.values || [])
75
75
  .map(v => {
76
76
  const valueName = v.name;
77
- const mappedValue = valuesMapping[valueName];
78
- return `${valueName}: ${typeof mappedValue === 'number' ? mappedValue : `'${mappedValue}'`}`;
77
+ const mappedValue = valuesMapping[valueName] ?? valueName;
78
+ const hasMapping = !!valuesMapping[valueName];
79
+ return `${valueName}${hasMapping || this.config.avoidOptionals.resolvers ? '' : '?'}: ${typeof mappedValue === 'number' ? mappedValue : `'${mappedValue}'`}`;
79
80
  })
80
81
  .join(', ')} }`;
81
82
  }
package/esm/visitor.js CHANGED
@@ -70,8 +70,9 @@ export class TypeScriptResolversVisitor extends BaseResolversVisitor {
70
70
  return `{ ${(node.values || [])
71
71
  .map(v => {
72
72
  const valueName = v.name;
73
- const mappedValue = valuesMapping[valueName];
74
- return `${valueName}: ${typeof mappedValue === 'number' ? mappedValue : `'${mappedValue}'`}`;
73
+ const mappedValue = valuesMapping[valueName] ?? valueName;
74
+ const hasMapping = !!valuesMapping[valueName];
75
+ return `${valueName}${hasMapping || this.config.avoidOptionals.resolvers ? '' : '?'}: ${typeof mappedValue === 'number' ? mappedValue : `'${mappedValue}'`}`;
75
76
  })
76
77
  .join(', ')} }`;
77
78
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphql-codegen/typescript-resolvers",
3
- "version": "4.5.2-alpha-20250627115156-9c57b83a4553fcece2f9fa6d83a61efd06c03b16",
3
+ "version": "4.5.2",
4
4
  "description": "GraphQL Code Generator plugin for generating TypeScript types for resolvers signature",
5
5
  "peerDependenciesMeta": {
6
6
  "graphql-sock": {
@@ -12,9 +12,9 @@
12
12
  "graphql-sock": "^1.0.0"
13
13
  },
14
14
  "dependencies": {
15
- "@graphql-codegen/plugin-helpers": "6.0.0-alpha-20250627115156-9c57b83a4553fcece2f9fa6d83a61efd06c03b16",
16
- "@graphql-codegen/typescript": "4.1.7-alpha-20250627115156-9c57b83a4553fcece2f9fa6d83a61efd06c03b16",
17
- "@graphql-codegen/visitor-plugin-common": "5.8.1-alpha-20250627115156-9c57b83a4553fcece2f9fa6d83a61efd06c03b16",
15
+ "@graphql-codegen/plugin-helpers": "^5.1.0",
16
+ "@graphql-codegen/typescript": "^4.1.6",
17
+ "@graphql-codegen/visitor-plugin-common": "5.8.0",
18
18
  "@graphql-tools/utils": "^10.0.0",
19
19
  "auto-bind": "~4.0.0",
20
20
  "tslib": "~2.6.0"