@@ -95,3 +95,44 @@ const { data } = wrappedExecute(typedQueryDocument);
9595if ( data != null ) {
9696 const typedData : ResponseData = data ;
9797}
98+
99+ declare function runQueryA (
100+ q : TypedQueryDocumentNode < { output : string } , { input : string | null } > ,
101+ ) : void ;
102+
103+ // valid
104+ declare const optionalInputRequiredOutput : TypedQueryDocumentNode <
105+ { output : string } ,
106+ { input : string | null }
107+ > ;
108+ runQueryA ( optionalInputRequiredOutput ) ;
109+
110+ declare function runQueryB (
111+ q : TypedQueryDocumentNode < { output : string | null } , { input : string } > ,
112+ ) : void ;
113+
114+ // still valid: We still accept {output: string} as a valid result.
115+ // We're now passing in {input: string} which is still assignable to {input: string | null}
116+ runQueryB ( optionalInputRequiredOutput ) ;
117+
118+ // valid: we now accept {output: null} as a valid Result
119+ declare const optionalInputOptionalOutput : TypedQueryDocumentNode <
120+ { output : string | null } ,
121+ { input : string | null }
122+ > ;
123+ runQueryB ( optionalInputOptionalOutput ) ;
124+
125+ // valid: we now only pass {input: string} to the query
126+ declare const requiredInputRequiredOutput : TypedQueryDocumentNode <
127+ { output : string } ,
128+ { input : string }
129+ > ;
130+ runQueryB ( requiredInputRequiredOutput ) ;
131+
132+ // valid: we now accept {output: null} as a valid Result AND
133+ // we now only pass {input: string} to the query
134+ declare const requiredInputOptionalOutput : TypedQueryDocumentNode <
135+ { output : null } ,
136+ { input : string }
137+ > ;
138+ runQueryB ( requiredInputOptionalOutput ) ;
0 commit comments