@genql/cli
Advanced tools
Comparing version 5.0.1 to 6.0.0
@@ -8,3 +8,3 @@ export declare type FieldsSelection<SRC extends Anify<DST> | undefined, DST> = { | ||
never: never; | ||
}[DST extends Nil ? 'never' : SRC extends Nil ? 'never' : DST extends false | 0 ? 'never' : SRC extends Scalar ? 'scalar' : SRC extends any[] ? 'array' : SRC extends { | ||
}[DST extends Nil ? 'never' : DST extends false | 0 ? 'never' : SRC extends Scalar ? 'scalar' : SRC extends any[] ? 'array' : SRC extends { | ||
__isUnion?: any; | ||
@@ -11,0 +11,0 @@ } ? 'union' : DST extends { |
@@ -121,2 +121,6 @@ "use strict"; | ||
}, | ||
optionalObject: { | ||
x: 1, | ||
optional: 1, | ||
} | ||
}; | ||
@@ -139,2 +143,10 @@ const z = {}; | ||
})); | ||
test('optional objects are preserved', dontExecute(() => { | ||
var _a; | ||
// @ts-expect-error | ||
z.optionalObject.x; | ||
(_a = z.optionalObject) === null || _a === void 0 ? void 0 : _a.x; | ||
// type is T | null | ||
z.optionalObject = null; | ||
})); | ||
test('optional fields are preserved in __scalar', dontExecute(() => { | ||
@@ -293,5 +305,5 @@ var _a, _b, _c, _d; | ||
test('accessible', dontExecute(() => { | ||
var _a; | ||
z.nullableField.x; | ||
(_a = z.nullableField.optional) === null || _a === void 0 ? void 0 : _a.big; | ||
var _a, _b, _c; | ||
(_a = z.nullableField) === null || _a === void 0 ? void 0 : _a.x; | ||
(_c = (_b = z.nullableField) === null || _b === void 0 ? void 0 : _b.optional) === null || _c === void 0 ? void 0 : _c.big; | ||
// @ts-expect-error optional | ||
@@ -298,0 +310,0 @@ z.nullableField.optional.big; |
{ | ||
"name": "@genql/cli", | ||
"version": "5.0.1", | ||
"version": "6.0.0", | ||
"description": "Generate a TypeScript SDK for any GraphQl API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -29,4 +29,2 @@ ////////////////////////////////////////////////// | ||
? 'never' | ||
: SRC extends Nil | ||
? 'never' | ||
: DST extends false | 0 | ||
@@ -33,0 +31,0 @@ ? 'never' |
@@ -55,2 +55,6 @@ import { FieldsSelection } from './runtime/typeSelection' | ||
} | ||
optionalObject: { | ||
x: string | ||
optional: string | null | ||
} | null | ||
order: { | ||
@@ -243,2 +247,6 @@ customer: { | ||
}, | ||
optionalObject: { | ||
x: 1, | ||
optional: 1, | ||
} | ||
} | ||
@@ -265,2 +273,12 @@ const z: FieldsSelection<SRC, typeof req> = {} as any | ||
test( | ||
'optional objects are preserved', | ||
dontExecute(() => { | ||
// @ts-expect-error | ||
z.optionalObject.x | ||
z.optionalObject?.x | ||
// type is T | null | ||
z.optionalObject = null | ||
}), | ||
) | ||
test( | ||
'optional fields are preserved in __scalar', | ||
@@ -450,4 +468,4 @@ dontExecute(() => { | ||
dontExecute(() => { | ||
z.nullableField.x | ||
z.nullableField.optional?.big | ||
z.nullableField?.x | ||
z.nullableField?.optional?.big | ||
// @ts-expect-error optional | ||
@@ -454,0 +472,0 @@ z.nullableField.optional.big |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
375970
7158