diff --git a/src/core/client/framework/lib/relay/lookup.ts b/src/core/client/framework/lib/relay/lookup.ts index d5a75c616..718dadcf9 100644 --- a/src/core/client/framework/lib/relay/lookup.ts +++ b/src/core/client/framework/lib/relay/lookup.ts @@ -36,7 +36,7 @@ const createProxy = ( return prop in recordSource; }, get(_, prop) { - if (prop in recordSource && (recordSource as any)[prop].__ref) { + if ((recordSource as any)[prop] && (recordSource as any)[prop].__ref) { return lookup(environment, (recordSource as any)[prop].__ref); } return (recordSource as any)[prop]; diff --git a/src/core/client/framework/testHelpers/createFixture.ts b/src/core/client/framework/testHelpers/createFixture.ts index 8b46357f8..7e163c012 100644 --- a/src/core/client/framework/testHelpers/createFixture.ts +++ b/src/core/client/framework/testHelpers/createFixture.ts @@ -8,16 +8,16 @@ import { DeepPartial } from "coral-framework/types"; export type Callbackify = T extends object ? | { - [P in keyof T]: T[P] extends Array + [P in keyof T]: T[P] extends (Array | undefined) ? Array> - : T[P] extends ReadonlyArray + : T[P] extends (ReadonlyArray | undefined) ? ReadonlyArray> : Callbackify } | (() => { - [P in keyof T]: T[P] extends Array + [P in keyof T]: T[P] extends (Array | undefined) ? Array> - : T[P] extends ReadonlyArray + : T[P] extends (ReadonlyArray | undefined) ? ReadonlyArray> : Callbackify }) @@ -28,9 +28,9 @@ export type Callbackify = T extends object */ export type WithTypename = T extends object ? { - [P in keyof T]: T[P] extends Array + [P in keyof T]: T[P] extends (Array | undefined) ? Array> - : T[P] extends ReadonlyArray + : T[P] extends (ReadonlyArray | undefined) ? ReadonlyArray> : WithTypename } & { __typename?: string } diff --git a/src/core/common/types.ts b/src/core/common/types.ts index 89b66e760..1ccecacc5 100644 --- a/src/core/common/types.ts +++ b/src/core/common/types.ts @@ -24,9 +24,9 @@ export type Nullable = { [P in keyof T]: T[P] | null }; export type DeepNullable = T extends object ? { - [P in keyof T]: T[P] extends Array + [P in keyof T]: T[P] extends (Array | undefined) ? Array> - : T[P] extends ReadonlyArray + : T[P] extends (ReadonlyArray | undefined) ? ReadonlyArray> : DeepNullable } @@ -37,9 +37,9 @@ export type DeepNullable = T extends object */ export type DeepPartial = T extends object ? { - [P in keyof T]?: T[P] extends Array + [P in keyof T]?: T[P] extends (Array | undefined) ? Array> - : T[P] extends ReadonlyArray + : T[P] extends (ReadonlyArray | undefined) ? ReadonlyArray> : DeepPartial }