graphql APIs
- GraphQLSchema
- DocumentNode
- GraphQLScalarType
- GraphQLObjectType
- GraphQLError
- buildSchema
- GraphQLResolveInfo
- parse
- GraphQLNonNull
- Kind
- GraphQLString
- GraphQLNamedType
- OperationDefinitionNode
- GraphQLEnumType
- GraphQLList
- GraphQLInputObjectType
- GraphQLInt
- GraphQLFloat
- GraphQLUnionType
- graphql
- GraphQLInterfaceType
- GraphQLField
- GraphQLBoolean
- getIntrospectionQuery
- FieldNode
- SelectionNode
- GraphQLOutputType
- printSchema
- GraphQLType
- SelectionSetNode
- Source
- buildClientSchema
- execute
- DefinitionNode
- FieldDefinitionNode
- isNonNullType
- validate
- isObjectType
- OperationTypeNode
- buildASTSchema
- GraphQLArgument
- visit
- ASTNode
- TypeNode
- NameNode
- NamedTypeNode
- isListType
- DirectiveNode
- StringValueNode
- isScalarType
- isInterfaceType
- ValueNode
- ExecutionResult
- GraphQLInputType
- TypeInfo
- visitWithTypeInfo
- ObjectTypeDefinitionNode
- ArgumentNode
- VariableDefinitionNode
- NonNullTypeNode
- Location
- FragmentDefinitionNode
- extendSchema
- specifiedDirectives
- getOperationAST
- validateSchema
- getNamedType
- GraphQLID
- isUnionType
- isInputObjectType
- GraphQLInputField
- subscribe
- ASTVisitor
- TypeDefinitionNode
- InterfaceTypeDefinitionNode
- VariableNode
- EnumTypeDefinitionNode
- InputValueDefinitionNode
- InlineFragmentNode
- ListTypeNode
- ValidationRule
- introspectionFromSchema
- defaultFieldResolver
- GraphQLFieldResolver
- IntrospectionField
- lexicographicSortSchema
- concatAST
- IntrospectionQuery
- isAbstractType
- GraphQLFieldConfigMap
- GraphQLFieldConfig
- GraphQLSchemaConfig
- GraphQLObjectTypeConfig
- printType
- isSpecifiedScalarType
- isEnumType
- GraphQLEnumValue
- specifiedRules
- GraphQLFieldMap
- GraphQLFormattedError
- ExecutableDefinitionNode
- ObjectTypeExtensionNode
- InterfaceTypeExtensionNode
- DirectiveDefinitionNode
- EnumTypeExtensionNode
- InputObjectTypeDefinitionNode
- InputObjectTypeExtensionNode
- TokenKind
- Token
- Lexer
- EnumValueNode
- ListValueNode
- BooleanValueNode
- BREAK
- GraphQLEnumTypeConfig
- GraphQLInputFieldConfigMap
- GraphQLFieldConfigArgumentMap
- GraphQLInterfaceTypeConfig
- GraphQLInputObjectTypeConfig
- GraphQLEnumValueConfigMap
- GraphQLTypeResolver
- isLeafType
- valueFromASTUntyped
- typeFromAST
- isCompositeType
- GraphQLCompositeType
- isType
- isEqualType
- SchemaMetaFieldDef
- TypeMetaFieldDef
- TypeNameMetaFieldDef
- NoUnusedFragmentsRule
- ValidationContext
- parseValue
- ExecutionArgs
- FormattedExecutionResult
- GraphQLEnumValueConfig
- TypeKind
- IntrospectionInputObjectType
- IntrospectionInputTypeRef
- IntrospectionInputValue
- IntrospectionListTypeRef
- IntrospectionNamedTypeRef
- IntrospectionNonNullTypeRef
- IntrospectionTypeRef
- IntrospectionType
- IntrospectionObjectType
- isNamedType
- assertValidSchema
Other Related APIs
graphql#isNamedType TypeScript Examples
The following examples show how to use
graphql#isNamedType.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: renderTyping.ts From genql with MIT License | 5 votes |
render = (
type: GraphQLOutputType | GraphQLInputType,
nonNull: boolean,
root: boolean,
undefinableValues: boolean,
undefinableFields: boolean,
wrap: (x: string) => string = x => x
): string => {
if (root) {
if (undefinableFields) {
if (isNonNullType(type)) {
return `: ${render(type.ofType, true, false, undefinableValues, undefinableFields, wrap)}`
} else {
const rendered = render(type, true, false, undefinableValues, undefinableFields, wrap)
return undefinableValues ? `?: ${rendered}` : `?: (${rendered} | null)`
}
} else {
return `: ${render(type, false, false, undefinableValues, undefinableFields, wrap)}`
}
}
if (isNamedType(type)) {
let typeName = type.name
// if is a scalar use the scalar interface to not expose reserved words
if (isScalarType(type)) {
typeName = `Scalars['${typeName}']`
}
const typing = wrap(typeName)
if (undefinableValues) {
return nonNull ? typing : `(${typing} | undefined)`
} else {
return nonNull ? typing : `(${typing} | null)`
}
}
if (isListType(type)) {
const typing = `${render(type.ofType, false, false, undefinableValues, undefinableFields, wrap)}[]`
if (undefinableValues) {
return nonNull ? typing : `(${typing} | undefined)`
} else {
return nonNull ? typing : `(${typing} | null)`
}
}
return render((<GraphQLNonNull<any>>type).ofType, true, false, undefinableValues, undefinableFields, wrap)
}