def parse_type(source: SourceType, **options: dict) -> TypeNode:
    """Parse the AST for a given string containing a GraphQL Type.

    Throws GraphQLError if a syntax error is encountered.

    This is useful within tools that operate upon GraphQL Types directly and
    in isolation of complete GraphQL documents.

    Consider providing the results to the utility function: `type_from_ast()`.
    """
    if isinstance(source, str):
        source = Source(source)
    lexer = Lexer(source, **options)
    expect_token(lexer, TokenKind.SOF)
    type_ = parse_type_reference(lexer)
    expect_token(lexer, TokenKind.EOF)
    return type_
def parse_type ( source : SourceType , ** options : dict ) -> TypeNode : if isinstance ( source , str ) : source = Source ( source ) lexer = Lexer ( source , ** options ) expect_token ( lexer , TokenKind . SOF ) type_ = parse_type_reference ( lexer ) expect_token ( lexer , TokenKind . EOF ) return type_
Parse the AST for a given string containing a GraphQL Type.

    Throws GraphQLError if a syntax error is encountered.

    This is useful within tools that operate upon GraphQL Types directly and
    in isolation of complete GraphQL documents.

    Consider providing the results to the utility function: `type_from_ast()`.