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; } `;