Skip to content

Commit e51f65e

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

21 files changed

Lines changed: 722 additions & 610 deletions

File tree

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

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,44 @@ 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: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
39+
): ReadonlyArray<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: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
44+
): ReadonlyArray<TType> | null | undefined;
45+
export function useFragment<TType>(
46+
_documentNode: DocumentTypeDecoration<TType, any>,
47+
fragmentType:
48+
| FragmentType<DocumentTypeDecoration<TType, any>>
49+
| Array<FragmentType<DocumentTypeDecoration<TType, any>>>
50+
| ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
51+
| null
52+
| undefined
53+
): TType | Array<TType> | ReadonlyArray<TType> | null | undefined {
4954
return fragmentType as any;
5055
}
5156

@@ -69,5 +74,5 @@ export function isFragmentReady<TQuery, TFrag>(
6974
const fragName = fragDef?.name?.value;
7075

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

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

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,44 @@ 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: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
39+
): ReadonlyArray<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: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
44+
): ReadonlyArray<TType> | null | undefined;
45+
export function useFragment<TType>(
46+
_documentNode: DocumentTypeDecoration<TType, any>,
47+
fragmentType:
48+
| FragmentType<DocumentTypeDecoration<TType, any>>
49+
| Array<FragmentType<DocumentTypeDecoration<TType, any>>>
50+
| ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
51+
| null
52+
| undefined
53+
): TType | Array<TType> | ReadonlyArray<TType> | null | undefined {
4954
return fragmentType as any;
5055
}
5156

@@ -69,5 +74,5 @@ export function isFragmentReady<TQuery, TFrag>(
6974
const fragName = fragDef?.name?.value;
7075

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

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

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,44 @@ 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: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
39+
): ReadonlyArray<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: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
44+
): ReadonlyArray<TType> | null | undefined;
45+
export function useFragment<TType>(
46+
_documentNode: DocumentTypeDecoration<TType, any>,
47+
fragmentType:
48+
| FragmentType<DocumentTypeDecoration<TType, any>>
49+
| Array<FragmentType<DocumentTypeDecoration<TType, any>>>
50+
| ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
51+
| null
52+
| undefined
53+
): TType | Array<TType> | ReadonlyArray<TType> | null | undefined {
4954
return fragmentType as any;
5055
}
5156

@@ -69,5 +74,5 @@ export function isFragmentReady<TQuery, TFrag>(
6974
const fragName = fragDef?.name?.value;
7075

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

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

Lines changed: 34 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -13,39 +13,44 @@ 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: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
39+
): ReadonlyArray<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: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
44+
): ReadonlyArray<TType> | null | undefined;
45+
export function useFragment<TType>(
46+
_documentNode: DocumentTypeDecoration<TType, any>,
47+
fragmentType:
48+
| FragmentType<DocumentTypeDecoration<TType, any>>
49+
| Array<FragmentType<DocumentTypeDecoration<TType, any>>>
50+
| ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
51+
| null
52+
| undefined
53+
): TType | Array<TType> | ReadonlyArray<TType> | null | undefined {
4954
return fragmentType as any;
5055
}
5156

@@ -69,5 +74,5 @@ export function isFragmentReady<TQuery, TFrag>(
6974
const fragName = fragDef?.name?.value;
7075

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

examples/persisted-documents-string-mode/src/gql/fragment-masking.ts

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

1414
// return non-nullable if `fragmentType` is non-nullable
15-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
16-
_documentNode: F,
17-
fragmentType: FragmentType<F>
18-
): ResultOf<F>;
15+
export function useFragment<TType>(
16+
_documentNode: DocumentTypeDecoration<TType, any>,
17+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>>
18+
): TType;
1919
// return nullable if `fragmentType` is undefined
20-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
21-
_documentNode: F,
22-
fragmentType: FragmentType<F> | undefined
23-
): ResultOf<F> | undefined;
20+
export function useFragment<TType>(
21+
_documentNode: DocumentTypeDecoration<TType, any>,
22+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | undefined
23+
): TType | undefined;
2424
// return nullable if `fragmentType` is nullable
25-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
26-
_documentNode: F,
27-
fragmentType: FragmentType<F> | null
28-
): ResultOf<F> | null;
25+
export function useFragment<TType>(
26+
_documentNode: DocumentTypeDecoration<TType, any>,
27+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null
28+
): TType | null;
2929
// return nullable if `fragmentType` is nullable or undefined
30-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
31-
_documentNode: F,
32-
fragmentType: FragmentType<F> | null | undefined
33-
): ResultOf<F> | null | undefined;
30+
export function useFragment<TType>(
31+
_documentNode: DocumentTypeDecoration<TType, any>,
32+
fragmentType: FragmentType<DocumentTypeDecoration<TType, any>> | null | undefined
33+
): TType | null | undefined;
3434
// return array of non-nullable if `fragmentType` is array of non-nullable
35-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
36-
_documentNode: F,
37-
fragmentType: ReadonlyArray<FragmentType<F>>
38-
): ReadonlyArray<ResultOf<F>>;
35+
export function useFragment<TType>(
36+
_documentNode: DocumentTypeDecoration<TType, any>,
37+
fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
38+
): ReadonlyArray<TType>;
3939
// return array of nullable if `fragmentType` is array of nullable
40-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
41-
_documentNode: F,
42-
fragmentType: ReadonlyArray<FragmentType<F>> | null | undefined
43-
): ReadonlyArray<ResultOf<F>> | null | undefined;
44-
export function useFragment<F extends DocumentTypeDecoration<any, any>>(
45-
_documentNode: F,
46-
fragmentType: FragmentType<F> | ReadonlyArray<FragmentType<F>> | null | undefined
47-
): ResultOf<F> | ReadonlyArray<ResultOf<F>> | null | undefined {
40+
export function useFragment<TType>(
41+
_documentNode: DocumentTypeDecoration<TType, any>,
42+
fragmentType: ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>> | null | undefined
43+
): ReadonlyArray<TType> | null | undefined;
44+
export function useFragment<TType>(
45+
_documentNode: DocumentTypeDecoration<TType, any>,
46+
fragmentType:
47+
| FragmentType<DocumentTypeDecoration<TType, any>>
48+
| Array<FragmentType<DocumentTypeDecoration<TType, any>>>
49+
| ReadonlyArray<FragmentType<DocumentTypeDecoration<TType, any>>>
50+
| null
51+
| undefined
52+
): TType | Array<TType> | ReadonlyArray<TType> | null | undefined {
4853
return fragmentType as any;
4954
}
5055

@@ -65,5 +70,5 @@ export function isFragmentReady<TQuery, TFrag>(
6570
if (!deferredFields || !fragName) return true;
6671

6772
const fields = deferredFields[fragName] ?? [];
68-
return fields.length > 0 && fields.every((field: keyof TFrag) => data && field in data);
73+
return fields.length > 0 && fields.every(field => data && field in data);
6974
}

0 commit comments

Comments
 (0)