这里的各种问号是什么意思?
type GraphQLEnumValueDefinition = {
name: string;
value?: any;
deprecationReason?: string;
description?: ?string;
}来源:https://graphql.org/graphql-js/type/#graphqlenumtype
在graphql中还有问号的其他用法吗?
发布于 2019-10-09 22:02:54
GraphQL.js是使用Flow编写的,它是一个静态类型检查器,在JavaScript之上引入了一些额外的语法。?表示一个Maybe Type,这仅仅意味着该值是可选的。因此,具有string类型的属性必须始终是string,而具有?string类型的属性可以是string、null或undefined。
因为GraphQL.js是用Flow编写的,所以它生成的文档包含Flow语法。但是,此语法与GraphQL本身无关。在GraphQL语法本身中,?不是一个标记。
https://stackoverflow.com/questions/58303683
复制相似问题