Skip to content

Commit

Permalink
fix: schema prop type fix (#2029)
Browse files Browse the repository at this point in the history
  • Loading branch information
kikkupico authored and acao committed Nov 23, 2021
1 parent 9efa672 commit c83d1d4
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 7 deletions.
5 changes: 5 additions & 0 deletions .changeset/bright-knives-cough.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'graphiql': patch
---

fix `schema` type nullability for #2028
6 changes: 3 additions & 3 deletions packages/graphiql/src/components/GraphiQL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export type GenericError =

export type GraphiQLProps = {
fetcher: Fetcher;
schema?: GraphQLSchema;
schema?: GraphQLSchema | null;
validationRules?: ValidationRule[];
query?: string;
variables?: string;
Expand Down Expand Up @@ -145,7 +145,7 @@ export type GraphiQLProps = {
};

export type GraphiQLState = {
schema?: GraphQLSchema;
schema?: GraphQLSchema | null;
query?: string;
variables?: string;
headers?: string;
Expand Down Expand Up @@ -1399,7 +1399,7 @@ export class GraphiQL extends React.Component<GraphiQLProps, GraphiQLState> {
query: string,
operationName?: string,
prevOperations?: OperationDefinitionNode[],
schema?: GraphQLSchema,
schema?: GraphQLSchema | null,
) => {
const queryFacts = getOperationFacts(schema, query);
if (queryFacts) {
Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql/src/components/QueryEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const md = new MD();
const AUTO_COMPLETE_AFTER_KEY = /^[a-zA-Z0-9_@(]$/;

type QueryEditorProps = {
schema?: GraphQLSchema;
schema?: GraphQLSchema | null;
validationRules?: ValidationRule[];
value?: string;
onEdit?: (value: string) => void;
Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql/src/utility/fillLeafs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export type GetDefaultFieldNamesFn = (type: GraphQLType) => string[];
* utility represents a "best effort" which may be useful within IDE tools.
*/
export function fillLeafs(
schema?: GraphQLSchema,
schema?: GraphQLSchema | null,
docString?: string,
getDefaultFieldNames?: GetDefaultFieldNamesFn,
) {
Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql/src/utility/getQueryFacts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export type QueryFacts = {
* If the query cannot be parsed, returns undefined.
*/
export default function getOperationFacts(
schema?: GraphQLSchema,
schema?: GraphQLSchema | null,
documentStr?: string | null,
): QueryFacts | undefined {
if (!documentStr) {
Expand Down
2 changes: 1 addition & 1 deletion packages/graphiql/src/utility/mergeAst.ts
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ export function inlineRelevantFragmentSpreads(
*/
export default function mergeAST(
documentAST: DocumentNode,
schema?: GraphQLSchema,
schema?: GraphQLSchema | null,
): DocumentNode {
// If we're given the schema, we can simplify even further by resolving object
// types vs unions/interfaces
Expand Down

2 comments on commit c83d1d4

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.