Skip to content

Commit 58a9ac9

Browse files
committed
Revert Client Preset changes
1 parent 3ab45f6 commit 58a9ac9

22 files changed

Lines changed: 961 additions & 639 deletions

File tree

dev-test/gql-tag-operations-masking/gql/fragment-masking.ts

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,54 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
1313
: never;
1414

1515
// return non-nullable if `fragmentType` is non-nullable
16-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
17-
_documentNode: F,
18-
fragmentType: FragmentType<F>
19-
): ResultOf<F>;
16+
export function useFragment<TType>(
17+
_documentNode: DocumentTypeDecoration<TType, any>,
18+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>
19+
): TType;
2020
// return nullable if `fragmentType` is undefined
21-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
22-
_documentNode: F,
23-
fragmentType: FragmentType<F> | undefined
24-
): ResultOf<F> | undefined;
21+
export function useFragment<TType>(
22+
_documentNode: DocumentTypeDecoration<TType, any>,
23+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | undefined
24+
): TType | undefined;
2525
// return nullable if `fragmentType` is nullable
26-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
27-
_documentNode: F,
28-
fragmentType: FragmentType<F> | null
29-
): ResultOf<F> | null;
26+
export function useFragment<TType>(
27+
_documentNode: DocumentTypeDecoration<TType, any>,
28+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null
29+
): TType | null;
3030
// return nullable if `fragmentType` is nullable or undefined
31-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
32-
_documentNode: F,
33-
fragmentType: FragmentType<F> | null | undefined
34-
): ResultOf<F> | null | undefined;
31+
export function useFragment<TType>(
32+
_documentNode: DocumentTypeDecoration<TType, any>,
33+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined
34+
): TType | null | undefined;
3535
// return array of non-nullable if `fragmentType` is array of non-nullable
36-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
37-
_documentNode: F,
38-
fragmentType: ReadonlyArray<FragmentType<F>>
39-
): ReadonlyArray<ResultOf<F>>;
36+
export function useFragment<TType>(
37+
_documentNode: DocumentTypeDecoration<TType, any>,
38+
fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>>
39+
): Array<TType>;
4040
// return array of nullable if `fragmentType` is array of nullable
41-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
42-
_documentNode: F,
43-
fragmentType: ReadonlyArray<FragmentType<F>> | null | undefined
44-
): ReadonlyArray<ResultOf<F>> | null | undefined;
45-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
46-
_documentNode: F,
47-
fragmentType: FragmentType<F> | ReadonlyArray<FragmentType<F>> | null | undefined
48-
): ResultOf<F> | ReadonlyArray<ResultOf<F>> | null | undefined {
41+
export function useFragment<TType>(
42+
_documentNode: DocumentTypeDecoration<TType, any>,
43+
fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
44+
): Array<TType> | null | undefined;
45+
// return readonly array of non-nullable if `fragmentType` is array of non-nullable
46+
export function useFragment<TType>(
47+
_documentNode: DocumentTypeDecoration<TType, any>,
48+
fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
49+
): ReadonlyArray<TType>;
50+
// return readonly array of nullable if `fragmentType` is array of nullable
51+
export function useFragment<TType>(
52+
_documentNode: DocumentTypeDecoration<TType, any>,
53+
fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
54+
): ReadonlyArray<TType> | null | undefined;
55+
export function useFragment<TType>(
56+
_documentNode: DocumentTypeDecoration<TType, any>,
57+
fragmentType:
58+
| FragmentType<DocumentTypeDecoration<TType, any>>
59+
| Array<FragmentType<DocumentTypeDecoration<TType, any>>>
60+
| ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
61+
| null
62+
| undefined
63+
): TType | Array<TType> | ReadonlyArray<TType> | null | undefined {
4964
return fragmentType as any;
5065
}
5166

@@ -69,5 +84,5 @@ export function isFragmentReady<TQuery, TFrag>(
6984
const fragName = fragDef?.name?.value;
7085

7186
const fields = (fragName && deferredFields[fragName]) || [];
72-
return fields.length > 0 && fields.every((field: keyof TFrag) => data && field in data);
87+
return fields.length > 0 && fields.every(field => data && field in data);
7388
}

dev-test/gql-tag-operations-urql/gql/fragment-masking.ts

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,54 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
1313
: never;
1414

1515
// return non-nullable if `fragmentType` is non-nullable
16-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
17-
_documentNode: F,
18-
fragmentType: FragmentType<F>
19-
): ResultOf<F>;
16+
export function useFragment<TType>(
17+
_documentNode: DocumentTypeDecoration<TType, any>,
18+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>
19+
): TType;
2020
// return nullable if `fragmentType` is undefined
21-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
22-
_documentNode: F,
23-
fragmentType: FragmentType<F> | undefined
24-
): ResultOf<F> | undefined;
21+
export function useFragment<TType>(
22+
_documentNode: DocumentTypeDecoration<TType, any>,
23+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | undefined
24+
): TType | undefined;
2525
// return nullable if `fragmentType` is nullable
26-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
27-
_documentNode: F,
28-
fragmentType: FragmentType<F> | null
29-
): ResultOf<F> | null;
26+
export function useFragment<TType>(
27+
_documentNode: DocumentTypeDecoration<TType, any>,
28+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null
29+
): TType | null;
3030
// return nullable if `fragmentType` is nullable or undefined
31-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
32-
_documentNode: F,
33-
fragmentType: FragmentType<F> | null | undefined
34-
): ResultOf<F> | null | undefined;
31+
export function useFragment<TType>(
32+
_documentNode: DocumentTypeDecoration<TType, any>,
33+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined
34+
): TType | null | undefined;
3535
// return array of non-nullable if `fragmentType` is array of non-nullable
36-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
37-
_documentNode: F,
38-
fragmentType: ReadonlyArray<FragmentType<F>>
39-
): ReadonlyArray<ResultOf<F>>;
36+
export function useFragment<TType>(
37+
_documentNode: DocumentTypeDecoration<TType, any>,
38+
fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>>
39+
): Array<TType>;
4040
// return array of nullable if `fragmentType` is array of nullable
41-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
42-
_documentNode: F,
43-
fragmentType: ReadonlyArray<FragmentType<F>> | null | undefined
44-
): ReadonlyArray<ResultOf<F>> | null | undefined;
45-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
46-
_documentNode: F,
47-
fragmentType: FragmentType<F> | ReadonlyArray<FragmentType<F>> | null | undefined
48-
): ResultOf<F> | ReadonlyArray<ResultOf<F>> | null | undefined {
41+
export function useFragment<TType>(
42+
_documentNode: DocumentTypeDecoration<TType, any>,
43+
fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
44+
): Array<TType> | null | undefined;
45+
// return readonly array of non-nullable if `fragmentType` is array of non-nullable
46+
export function useFragment<TType>(
47+
_documentNode: DocumentTypeDecoration<TType, any>,
48+
fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
49+
): ReadonlyArray<TType>;
50+
// return readonly array of nullable if `fragmentType` is array of nullable
51+
export function useFragment<TType>(
52+
_documentNode: DocumentTypeDecoration<TType, any>,
53+
fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
54+
): ReadonlyArray<TType> | null | undefined;
55+
export function useFragment<TType>(
56+
_documentNode: DocumentTypeDecoration<TType, any>,
57+
fragmentType:
58+
| FragmentType<DocumentTypeDecoration<TType, any>>
59+
| Array<FragmentType<DocumentTypeDecoration<TType, any>>>
60+
| ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
61+
| null
62+
| undefined
63+
): TType | Array<TType> | ReadonlyArray<TType> | null | undefined {
4964
return fragmentType as any;
5065
}
5166

@@ -69,5 +84,5 @@ export function isFragmentReady<TQuery, TFrag>(
6984
const fragName = fragDef?.name?.value;
7085

7186
const fields = (fragName && deferredFields[fragName]) || [];
72-
return fields.length > 0 && fields.every((field: keyof TFrag) => data && field in data);
87+
return fields.length > 0 && fields.every(field => data && field in data);
7388
}

dev-test/gql-tag-operations/gql/fragment-masking.ts

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,54 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
1313
: never;
1414

1515
// return non-nullable if `fragmentType` is non-nullable
16-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
17-
_documentNode: F,
18-
fragmentType: FragmentType<F>
19-
): ResultOf<F>;
16+
export function useFragment<TType>(
17+
_documentNode: DocumentTypeDecoration<TType, any>,
18+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>
19+
): TType;
2020
// return nullable if `fragmentType` is undefined
21-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
22-
_documentNode: F,
23-
fragmentType: FragmentType<F> | undefined
24-
): ResultOf<F> | undefined;
21+
export function useFragment<TType>(
22+
_documentNode: DocumentTypeDecoration<TType, any>,
23+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | undefined
24+
): TType | undefined;
2525
// return nullable if `fragmentType` is nullable
26-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
27-
_documentNode: F,
28-
fragmentType: FragmentType<F> | null
29-
): ResultOf<F> | null;
26+
export function useFragment<TType>(
27+
_documentNode: DocumentTypeDecoration<TType, any>,
28+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null
29+
): TType | null;
3030
// return nullable if `fragmentType` is nullable or undefined
31-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
32-
_documentNode: F,
33-
fragmentType: FragmentType<F> | null | undefined
34-
): ResultOf<F> | null | undefined;
31+
export function useFragment<TType>(
32+
_documentNode: DocumentTypeDecoration<TType, any>,
33+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined
34+
): TType | null | undefined;
3535
// return array of non-nullable if `fragmentType` is array of non-nullable
36-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
37-
_documentNode: F,
38-
fragmentType: ReadonlyArray<FragmentType<F>>
39-
): ReadonlyArray<ResultOf<F>>;
36+
export function useFragment<TType>(
37+
_documentNode: DocumentTypeDecoration<TType, any>,
38+
fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>>
39+
): Array<TType>;
4040
// return array of nullable if `fragmentType` is array of nullable
41-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
42-
_documentNode: F,
43-
fragmentType: ReadonlyArray<FragmentType<F>> | null | undefined
44-
): ReadonlyArray<ResultOf<F>> | null | undefined;
45-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
46-
_documentNode: F,
47-
fragmentType: FragmentType<F> | ReadonlyArray<FragmentType<F>> | null | undefined
48-
): ResultOf<F> | ReadonlyArray<ResultOf<F>> | null | undefined {
41+
export function useFragment<TType>(
42+
_documentNode: DocumentTypeDecoration<TType, any>,
43+
fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
44+
): Array<TType> | null | undefined;
45+
// return readonly array of non-nullable if `fragmentType` is array of non-nullable
46+
export function useFragment<TType>(
47+
_documentNode: DocumentTypeDecoration<TType, any>,
48+
fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
49+
): ReadonlyArray<TType>;
50+
// return readonly array of nullable if `fragmentType` is array of nullable
51+
export function useFragment<TType>(
52+
_documentNode: DocumentTypeDecoration<TType, any>,
53+
fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
54+
): ReadonlyArray<TType> | null | undefined;
55+
export function useFragment<TType>(
56+
_documentNode: DocumentTypeDecoration<TType, any>,
57+
fragmentType:
58+
| FragmentType<DocumentTypeDecoration<TType, any>>
59+
| Array<FragmentType<DocumentTypeDecoration<TType, any>>>
60+
| ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
61+
| null
62+
| undefined
63+
): TType | Array<TType> | ReadonlyArray<TType> | null | undefined {
4964
return fragmentType as any;
5065
}
5166

@@ -69,5 +84,5 @@ export function isFragmentReady<TQuery, TFrag>(
6984
const fragName = fragDef?.name?.value;
7085

7186
const fields = (fragName && deferredFields[fragName]) || [];
72-
return fields.length > 0 && fields.every((field: keyof TFrag) => data && field in data);
87+
return fields.length > 0 && fields.every(field => data && field in data);
7388
}

dev-test/gql-tag-operations/graphql/fragment-masking.ts

Lines changed: 44 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,54 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
1313
: never;
1414

1515
// return non-nullable if `fragmentType` is non-nullable
16-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
17-
_documentNode: F,
18-
fragmentType: FragmentType<F>
19-
): ResultOf<F>;
16+
export function useFragment<TType>(
17+
_documentNode: DocumentTypeDecoration<TType, any>,
18+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>
19+
): TType;
2020
// return nullable if `fragmentType` is undefined
21-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
22-
_documentNode: F,
23-
fragmentType: FragmentType<F> | undefined
24-
): ResultOf<F> | undefined;
21+
export function useFragment<TType>(
22+
_documentNode: DocumentTypeDecoration<TType, any>,
23+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | undefined
24+
): TType | undefined;
2525
// return nullable if `fragmentType` is nullable
26-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
27-
_documentNode: F,
28-
fragmentType: FragmentType<F> | null
29-
): ResultOf<F> | null;
26+
export function useFragment<TType>(
27+
_documentNode: DocumentTypeDecoration<TType, any>,
28+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null
29+
): TType | null;
3030
// return nullable if `fragmentType` is nullable or undefined
31-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
32-
_documentNode: F,
33-
fragmentType: FragmentType<F> | null | undefined
34-
): ResultOf<F> | null | undefined;
31+
export function useFragment<TType>(
32+
_documentNode: DocumentTypeDecoration<TType, any>,
33+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined
34+
): TType | null | undefined;
3535
// return array of non-nullable if `fragmentType` is array of non-nullable
36-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
37-
_documentNode: F,
38-
fragmentType: ReadonlyArray<FragmentType<F>>
39-
): ReadonlyArray<ResultOf<F>>;
36+
export function useFragment<TType>(
37+
_documentNode: DocumentTypeDecoration<TType, any>,
38+
fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>>
39+
): Array<TType>;
4040
// return array of nullable if `fragmentType` is array of nullable
41-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
42-
_documentNode: F,
43-
fragmentType: ReadonlyArray<FragmentType<F>> | null | undefined
44-
): ReadonlyArray<ResultOf<F>> | null | undefined;
45-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
46-
_documentNode: F,
47-
fragmentType: FragmentType<F> | ReadonlyArray<FragmentType<F>> | null | undefined
48-
): ResultOf<F> | ReadonlyArray<ResultOf<F>> | null | undefined {
41+
export function useFragment<TType>(
42+
_documentNode: DocumentTypeDecoration<TType, any>,
43+
fragmentType: Array<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
44+
): Array<TType> | null | undefined;
45+
// return readonly array of non-nullable if `fragmentType` is array of non-nullable
46+
export function useFragment<TType>(
47+
_documentNode: DocumentTypeDecoration<TType, any>,
48+
fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
49+
): ReadonlyArray<TType>;
50+
// return readonly array of nullable if `fragmentType` is array of nullable
51+
export function useFragment<TType>(
52+
_documentNode: DocumentTypeDecoration<TType, any>,
53+
fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
54+
): ReadonlyArray<TType> | null | undefined;
55+
export function useFragment<TType>(
56+
_documentNode: DocumentTypeDecoration<TType, any>,
57+
fragmentType:
58+
| FragmentType<DocumentTypeDecoration<TType, any>>
59+
| Array<FragmentType<DocumentTypeDecoration<TType, any>>>
60+
| ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
61+
| null
62+
| undefined
63+
): TType | Array<TType> | ReadonlyArray<TType> | null | undefined {
4964
return fragmentType as any;
5065
}
5166

@@ -69,5 +84,5 @@ export function isFragmentReady<TQuery, TFrag>(
6984
const fragName = fragDef?.name?.value;
7085

7186
const fields = (fragName && deferredFields[fragName]) || [];
72-
return fields.length > 0 && fields.every((field: keyof TFrag) => data && field in data);
87+
return fields.length > 0 && fields.every(field => data && field in data);
7388
}

0 commit comments

Comments
 (0)