Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
5 changes: 0 additions & 5 deletions dev-test/general/gql-tag-operations/gql/fragment-masking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
5 changes: 0 additions & 5 deletions examples/persisted-documents/src/gql/fragment-masking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
5 changes: 0 additions & 5 deletions examples/react/apollo-client/src/gql/fragment-masking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
5 changes: 0 additions & 5 deletions examples/react/http-executor/src/gql/fragment-masking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
5 changes: 0 additions & 5 deletions examples/react/urql/src/gql/fragment-masking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
5 changes: 0 additions & 5 deletions examples/typescript-esm/src/gql/fragment-masking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
5 changes: 0 additions & 5 deletions examples/vite/vite-react-cts/src/gql/fragment-masking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
5 changes: 0 additions & 5 deletions examples/vite/vite-react-mts/src/gql/fragment-masking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
5 changes: 0 additions & 5 deletions examples/vite/vite-react-ts/src/gql/fragment-masking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
5 changes: 0 additions & 5 deletions examples/vue/apollo-composable/src/gql/fragment-masking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
5 changes: 0 additions & 5 deletions examples/vue/urql/src/gql/fragment-masking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
5 changes: 0 additions & 5 deletions examples/vue/villus/src/gql/fragment-masking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
5 changes: 0 additions & 5 deletions examples/yoga-tests/src/gql/fragment-masking.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ export type FragmentType<TDocumentType extends DocumentTypeDecoration<any, any>>
: never
: never;

// return partial if `fragmentType` is partial e.g. because of conditional directives
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>,
): Partial<TType>;
// return non-nullable if `fragmentType` is non-nullable
export function useFragment<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1023,11 +1023,12 @@ export class SelectionSetToObject<
fields.push(
`{ ' $fragmentRefs'?: { ${fragmentsSpreadUsages
.map(name => {
// FIXME: https://github.com/dotansimha/graphql-code-generator/pull/10904/changes#r3729881814
// A conditional (`@skip`/`@include`) masked spread may be absent,
// so its data is wrapped in `Partial`.
if (options.partialTypes) {
return `'${name}': Partial<${name}>`;
}
// if (options.partialTypes) {
// return `'${name}': Partial<${name}>`;
// }
if (options.unsetTypes) {
return `'${name}': Incremental<${name}>`;
}
Expand Down
11 changes: 6 additions & 5 deletions packages/presets/client/src/fragment-masking-plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ export function makeFragmentData<
const defaultUnmaskFunctionName = 'useFragment';

const createUnmaskFunctionTypeDefinitions = (unmaskFunctionName = defaultUnmaskFunctionName) => [
`// return partial if \`fragmentType\` is partial e.g. because of conditional directives
export function ${unmaskFunctionName}<TType>(
_documentNode: DocumentTypeDecoration<TType, any>,
fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>
): Partial<TType>;`,
// FIXME: https://github.com/dotansimha/graphql-code-generator/pull/10904/changes#r3729881814
// `// return partial if \`fragmentType\` is partial e.g. because of conditional directives
// export function ${unmaskFunctionName}<TType>(
// _documentNode: DocumentTypeDecoration<TType, any>,
// fragmentType: FragmentType<DocumentTypeDecoration<Partial<TType>, any>>
// ): Partial<TType>;`,

`// return non-nullable if \`fragmentType\` is non-nullable
export function ${unmaskFunctionName}<TType>(
Expand Down
Loading
Loading