Reputation: 31997
What are the meanings of the various question marks here?
type GraphQLEnumValueDefinition = {
name: string;
value?: any;
deprecationReason?: string;
description?: ?string;
}
source: https://graphql.org/graphql-js/type/#graphqlenumtype
Are there other usages of question mark within graphql?
Upvotes: 2
Views: 2269
Reputation: 84777
GraphQL.js is written using Flow, which is a static type checker that introduces some additional syntax on top of JavaScript. The ?
indicates a Maybe Type which simply means the value is optional. So a property that has the string
type must always be a string, while one with the ?string
type could be a string, null
or undefined
.
Because GraphQL.js is written in Flow, it's generated documentation includes Flow syntax. However, this syntax is unrelated to GraphQL itself. ?
is not a token in GraphQL syntax itself.
Upvotes: 4