diff --git a/.changeset/gentle-suits-provide.md b/.changeset/gentle-suits-provide.md new file mode 100644 index 00000000000..b09e4103f32 --- /dev/null +++ b/.changeset/gentle-suits-provide.md @@ -0,0 +1,5 @@ +--- +'@graphql-codegen/client-preset': patch +--- + +Add additional types to useFragment codegen for support array of nullable gql types diff --git a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts index a6b3407f590..483a04b9d54 100644 --- a/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-masking/gql/fragment-masking.ts @@ -42,6 +42,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -52,15 +62,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts index a6b3407f590..483a04b9d54 100644 --- a/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations-urql/gql/fragment-masking.ts @@ -42,6 +42,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -52,15 +62,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/dev-test/gql-tag-operations/gql/fragment-masking.ts b/dev-test/gql-tag-operations/gql/fragment-masking.ts index a6b3407f590..483a04b9d54 100644 --- a/dev-test/gql-tag-operations/gql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/gql/fragment-masking.ts @@ -42,6 +42,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -52,15 +62,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/dev-test/gql-tag-operations/graphql/fragment-masking.ts b/dev-test/gql-tag-operations/graphql/fragment-masking.ts index a6b3407f590..483a04b9d54 100644 --- a/dev-test/gql-tag-operations/graphql/fragment-masking.ts +++ b/dev-test/gql-tag-operations/graphql/fragment-masking.ts @@ -42,6 +42,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -52,15 +62,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts index dedac7e7f7e..1d8f86816e3 100644 --- a/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts +++ b/examples/persisted-documents-string-mode/src/gql/fragment-masking.ts @@ -41,6 +41,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -51,15 +61,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/examples/persisted-documents/src/gql/fragment-masking.ts b/examples/persisted-documents/src/gql/fragment-masking.ts index c469b9c617c..cad142730a0 100644 --- a/examples/persisted-documents/src/gql/fragment-masking.ts +++ b/examples/persisted-documents/src/gql/fragment-masking.ts @@ -42,6 +42,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -52,15 +62,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts index c469b9c617c..cad142730a0 100644 --- a/examples/react/apollo-client-defer/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-defer/src/gql/fragment-masking.ts @@ -42,6 +42,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -52,15 +62,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts index c469b9c617c..cad142730a0 100644 --- a/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client-swc-plugin/src/gql/fragment-masking.ts @@ -42,6 +42,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -52,15 +62,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/examples/react/apollo-client/src/gql/fragment-masking.ts b/examples/react/apollo-client/src/gql/fragment-masking.ts index c469b9c617c..cad142730a0 100644 --- a/examples/react/apollo-client/src/gql/fragment-masking.ts +++ b/examples/react/apollo-client/src/gql/fragment-masking.ts @@ -42,6 +42,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -52,15 +62,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/examples/react/http-executor/src/gql/fragment-masking.ts b/examples/react/http-executor/src/gql/fragment-masking.ts index c469b9c617c..cad142730a0 100644 --- a/examples/react/http-executor/src/gql/fragment-masking.ts +++ b/examples/react/http-executor/src/gql/fragment-masking.ts @@ -42,6 +42,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -52,15 +62,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/examples/react/nextjs-swr/gql/fragment-masking.ts b/examples/react/nextjs-swr/gql/fragment-masking.ts index c469b9c617c..cad142730a0 100644 --- a/examples/react/nextjs-swr/gql/fragment-masking.ts +++ b/examples/react/nextjs-swr/gql/fragment-masking.ts @@ -42,6 +42,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -52,15 +62,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts index dedac7e7f7e..1d8f86816e3 100644 --- a/examples/react/tanstack-react-query/src/gql/fragment-masking.ts +++ b/examples/react/tanstack-react-query/src/gql/fragment-masking.ts @@ -41,6 +41,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -51,15 +61,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/examples/react/urql/src/gql/fragment-masking.ts b/examples/react/urql/src/gql/fragment-masking.ts index dedac7e7f7e..1d8f86816e3 100644 --- a/examples/react/urql/src/gql/fragment-masking.ts +++ b/examples/react/urql/src/gql/fragment-masking.ts @@ -41,6 +41,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -51,15 +61,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/examples/typescript-esm/src/gql/fragment-masking.ts b/examples/typescript-esm/src/gql/fragment-masking.ts index a6b3407f590..483a04b9d54 100644 --- a/examples/typescript-esm/src/gql/fragment-masking.ts +++ b/examples/typescript-esm/src/gql/fragment-masking.ts @@ -42,6 +42,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -52,15 +62,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/examples/typescript-graphql-request/src/gql/fragment-masking.ts b/examples/typescript-graphql-request/src/gql/fragment-masking.ts index dedac7e7f7e..1d8f86816e3 100644 --- a/examples/typescript-graphql-request/src/gql/fragment-masking.ts +++ b/examples/typescript-graphql-request/src/gql/fragment-masking.ts @@ -41,6 +41,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -51,15 +61,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts index c469b9c617c..cad142730a0 100644 --- a/examples/vite/vite-react-cts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-cts/src/gql/fragment-masking.ts @@ -42,6 +42,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -52,15 +62,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts index c469b9c617c..cad142730a0 100644 --- a/examples/vite/vite-react-mts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-mts/src/gql/fragment-masking.ts @@ -42,6 +42,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -52,15 +62,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts index c469b9c617c..cad142730a0 100644 --- a/examples/vite/vite-react-ts/src/gql/fragment-masking.ts +++ b/examples/vite/vite-react-ts/src/gql/fragment-masking.ts @@ -42,6 +42,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -52,15 +62,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/examples/vue/apollo-composable/src/gql/fragment-masking.ts b/examples/vue/apollo-composable/src/gql/fragment-masking.ts index a97fd9b635e..aec3799c765 100644 --- a/examples/vue/apollo-composable/src/gql/fragment-masking.ts +++ b/examples/vue/apollo-composable/src/gql/fragment-masking.ts @@ -42,6 +42,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -52,15 +62,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/examples/vue/urql/src/gql/fragment-masking.ts b/examples/vue/urql/src/gql/fragment-masking.ts index a97fd9b635e..aec3799c765 100644 --- a/examples/vue/urql/src/gql/fragment-masking.ts +++ b/examples/vue/urql/src/gql/fragment-masking.ts @@ -42,6 +42,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -52,15 +62,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/examples/vue/villus/src/gql/fragment-masking.ts b/examples/vue/villus/src/gql/fragment-masking.ts index a97fd9b635e..aec3799c765 100644 --- a/examples/vue/villus/src/gql/fragment-masking.ts +++ b/examples/vue/villus/src/gql/fragment-masking.ts @@ -42,6 +42,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -52,15 +62,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/examples/yoga-tests/src/gql/fragment-masking.ts b/examples/yoga-tests/src/gql/fragment-masking.ts index c469b9c617c..cad142730a0 100644 --- a/examples/yoga-tests/src/gql/fragment-masking.ts +++ b/examples/yoga-tests/src/gql/fragment-masking.ts @@ -42,6 +42,16 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; +// return nullable array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined; +// return nullable array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined; // return readonly array of non-nullable if `fragmentType` is array of non-nullable export function useFragment( _documentNode: DocumentTypeDecoration, @@ -52,15 +62,25 @@ export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; +// return nullable readonly array of non-nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined; +// return nullable readonly array of nullable if `fragmentType` is nullable array of nullable +export function useFragment( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined; export function useFragment( _documentNode: DocumentTypeDecoration, fragmentType: | FragmentType> - | Array>> - | ReadonlyArray>> + | Array> | null> + | ReadonlyArray> | null> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } diff --git a/packages/presets/client/src/fragment-masking-plugin.ts b/packages/presets/client/src/fragment-masking-plugin.ts index f3e69e3c6bf..0f69aff68b7 100644 --- a/packages/presets/client/src/fragment-masking-plugin.ts +++ b/packages/presets/client/src/fragment-masking-plugin.ts @@ -59,6 +59,18 @@ export function ${unmaskFunctionName}( fragmentType: Array>> | null | undefined ): Array | null | undefined;`, + `// return nullable array of non-nullable if \`fragmentType\` is nullable array of nullable +export function ${unmaskFunctionName}( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined +): Array | undefined;`, + + `// return nullable array of nullable if \`fragmentType\` is nullable array of nullable +export function ${unmaskFunctionName}( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined +): Array | null | undefined;`, + `// return readonly array of non-nullable if \`fragmentType\` is array of non-nullable export function ${unmaskFunctionName}( _documentNode: DocumentTypeDecoration, @@ -70,14 +82,26 @@ export function ${unmaskFunctionName}( _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined;`, + + `// return nullable readonly array of non-nullable if \`fragmentType\` is nullable array of nullable +export function ${unmaskFunctionName}( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined +): ReadonlyArray | undefined;`, + + `// return nullable readonly array of nullable if \`fragmentType\` is nullable array of nullable +export function ${unmaskFunctionName}( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined +): ReadonlyArray | null | undefined;`, ]; const createUnmaskFunction = (unmaskFunctionName = defaultUnmaskFunctionName) => ` ${createUnmaskFunctionTypeDefinitions(unmaskFunctionName).join('\n')} export function ${unmaskFunctionName}( _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType> | Array>> | ReadonlyArray>> | null | undefined -): TType | Array | ReadonlyArray | null | undefined { + fragmentType: FragmentType> | Array> | null> | ReadonlyArray> | null> | null | undefined +): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; } `; diff --git a/packages/presets/client/tests/client-preset.spec.ts b/packages/presets/client/tests/client-preset.spec.ts index d318313ad55..6e8b3eca0ee 100644 --- a/packages/presets/client/tests/client-preset.spec.ts +++ b/packages/presets/client/tests/client-preset.spec.ts @@ -931,6 +931,16 @@ export * from "./gql";`); _documentNode: DocumentTypeDecoration, fragmentType: Array>> | null | undefined ): Array | null | undefined; + // return nullable array of non-nullable if \`fragmentType\` is nullable array of nullable + export function iLikeTurtles( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | undefined + ): Array | undefined; + // return nullable array of nullable if \`fragmentType\` is nullable array of nullable + export function iLikeTurtles( + _documentNode: DocumentTypeDecoration, + fragmentType: Array> | null> | null | undefined + ): Array | null | undefined; // return readonly array of non-nullable if \`fragmentType\` is array of non-nullable export function iLikeTurtles( _documentNode: DocumentTypeDecoration, @@ -941,10 +951,20 @@ export * from "./gql";`); _documentNode: DocumentTypeDecoration, fragmentType: ReadonlyArray>> | null | undefined ): ReadonlyArray | null | undefined; + // return nullable readonly array of non-nullable if \`fragmentType\` is nullable array of nullable + export function iLikeTurtles( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | undefined + ): ReadonlyArray | undefined; + // return nullable readonly array of nullable if \`fragmentType\` is nullable array of nullable + export function iLikeTurtles( + _documentNode: DocumentTypeDecoration, + fragmentType: ReadonlyArray> | null> | null | undefined + ): ReadonlyArray | null | undefined; export function iLikeTurtles( _documentNode: DocumentTypeDecoration, - fragmentType: FragmentType> | Array>> | ReadonlyArray>> | null | undefined - ): TType | Array | ReadonlyArray | null | undefined { + fragmentType: FragmentType> | Array> | null> | ReadonlyArray> | null> | null | undefined + ): TType | Array | ReadonlyArray | null | undefined { return fragmentType as any; }