@graphql-codegen/visitor-plugin-common
Advanced tools
Comparing version 1.0.7-alpha-19141733.22 to 1.0.7-alpha-1b094569.41
@@ -350,2 +350,3 @@ "use strict"; | ||
const type = this.getTypeToUse(node.name); | ||
const possibleTypes = implementingTypes.map(name => `'${name}'`).join(' | ') || 'null'; | ||
return new utils_1.DeclarationBlock(this._declarationBlockConfig) | ||
@@ -355,3 +356,3 @@ .export() | ||
.withName(name, `<Context = ${this.config.contextType.type}, ParentType = ${type}>`) | ||
.withBlock([utils_1.indent(`__resolveType: TypeResolveFn<${implementingTypes.map(name => `'${name}'`).join(' | ')}, ParentType, Context>,`), ...(node.fields || []).map((f) => f(node.name))].join('\n')).string; | ||
.withBlock([utils_1.indent(`__resolveType: TypeResolveFn<${possibleTypes}, ParentType, Context>,`), ...(node.fields || []).map((f) => f(node.name))].join('\n')).string; | ||
} | ||
@@ -358,0 +359,0 @@ SchemaDefinition() { |
@@ -193,3 +193,3 @@ "use strict"; | ||
const typeFragments = fragments[typeName]; | ||
const interfacesFragments = schemaType.getInterfaces().filter(gqlInterface => !!interfaces[gqlInterface.name]); | ||
const interfacesFragments = schemaType.getInterfaces === undefined ? [] : schemaType.getInterfaces().filter(gqlInterface => !!interfaces[gqlInterface.name]); | ||
if (interfacesFragments.length > 0) { | ||
@@ -196,0 +196,0 @@ for (const relevantInterface of interfacesFragments) { |
@@ -348,2 +348,3 @@ import { BaseVisitor } from './base-visitor'; | ||
const type = this.getTypeToUse(node.name); | ||
const possibleTypes = implementingTypes.map(name => `'${name}'`).join(' | ') || 'null'; | ||
return new DeclarationBlock(this._declarationBlockConfig) | ||
@@ -353,3 +354,3 @@ .export() | ||
.withName(name, `<Context = ${this.config.contextType.type}, ParentType = ${type}>`) | ||
.withBlock([indent(`__resolveType: TypeResolveFn<${implementingTypes.map(name => `'${name}'`).join(' | ')}, ParentType, Context>,`), ...(node.fields || []).map((f) => f(node.name))].join('\n')).string; | ||
.withBlock([indent(`__resolveType: TypeResolveFn<${possibleTypes}, ParentType, Context>,`), ...(node.fields || []).map((f) => f(node.name))].join('\n')).string; | ||
} | ||
@@ -356,0 +357,0 @@ SchemaDefinition() { |
@@ -191,3 +191,3 @@ import { Kind, isObjectType, isUnionType, isInterfaceType, isEnumType, isEqualType, SchemaMetaFieldDef, TypeMetaFieldDef, isScalarType, } from 'graphql'; | ||
const typeFragments = fragments[typeName]; | ||
const interfacesFragments = schemaType.getInterfaces().filter(gqlInterface => !!interfaces[gqlInterface.name]); | ||
const interfacesFragments = schemaType.getInterfaces === undefined ? [] : schemaType.getInterfaces().filter(gqlInterface => !!interfaces[gqlInterface.name]); | ||
if (interfacesFragments.length > 0) { | ||
@@ -194,0 +194,0 @@ for (const relevantInterface of interfacesFragments) { |
{ | ||
"name": "@graphql-codegen/visitor-plugin-common", | ||
"version": "1.0.7-alpha-19141733.22+19141733", | ||
"version": "1.0.7-alpha-1b094569.41+1b094569", | ||
"license": "MIT", | ||
@@ -10,3 +10,3 @@ "scripts": { | ||
"dependencies": { | ||
"@graphql-codegen/plugin-helpers": "1.0.7-alpha-19141733.22+19141733", | ||
"@graphql-codegen/plugin-helpers": "1.0.7-alpha-1b094569.41+1b094569", | ||
"auto-bind": "2.0.0", | ||
@@ -21,8 +21,8 @@ "dependency-graph": "0.8.0", | ||
"devDependencies": { | ||
"@graphql-codegen/testing": "1.0.7-alpha-19141733.22+19141733", | ||
"@graphql-codegen/testing": "1.0.7-alpha-1b094569.41+1b094569", | ||
"@types/graphql": "14.2.0", | ||
"@types/jest": "24.0.11", | ||
"graphql": "14.2.1", | ||
"jest": "24.5.0", | ||
"ts-jest": "24.0.1", | ||
"jest": "24.7.1", | ||
"ts-jest": "24.0.2", | ||
"typescript": "3.4.1" | ||
@@ -40,3 +40,3 @@ }, | ||
}, | ||
"gitHead": "191417333e7332a6ea5da4bc028cd4e18dd6d409" | ||
"gitHead": "1b0945699e11f54d1e757d8ca53d98d14693b3ee" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Manifest confusion
Supply chain riskThis package has inconsistent metadata. This could be malicious or caused by an error when publishing the package.
Found 1 instance in 1 package
272156
3984