Skip to content

AST: IntValueNode and FloatValueNode store values as string #4014

Closed
@SeppahBaws

Description

@SeppahBaws

Using the AST provided by the library, I'm doing some introspection on the queries to extract the default values passed in to a query.

I noticed that the IntValueNode and FloatValueNode types both use string to store the value instead of number.

export interface IntValueNode {
readonly kind: Kind.INT;
readonly loc?: Location | undefined;
readonly value: string;
}

export interface FloatValueNode {
readonly kind: Kind.FLOAT;
readonly loc?: Location | undefined;
readonly value: string;
}

This seems a bit counter-intuitive to me, and would require me to write some custom parsing code on top of the existing parsing that graphql-js does.
Is this an intentional decision to store the values in a string instead of a number, or is it something that should be changed?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions