From a7248af41ef068e74b7aaef002614bd8fb2f7591 Mon Sep 17 00:00:00 2001 From: Jacob Ley Date: Fri, 1 Nov 2024 02:13:16 +0000 Subject: [PATCH] Use consistent record type --- .changeset/olive-zoos-care.md | 5 +++++ apps/juniper/src/schemas/object.ts | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) create mode 100644 .changeset/olive-zoos-care.md diff --git a/.changeset/olive-zoos-care.md b/.changeset/olive-zoos-care.md new file mode 100644 index 00000000..dc4ac4a5 --- /dev/null +++ b/.changeset/olive-zoos-care.md @@ -0,0 +1,5 @@ +--- +"juniper": patch +--- + +Use consistent record type diff --git a/apps/juniper/src/schemas/object.ts b/apps/juniper/src/schemas/object.ts index 5f81bdd1..7570fad1 100644 --- a/apps/juniper/src/schemas/object.ts +++ b/apps/juniper/src/schemas/object.ts @@ -499,7 +499,7 @@ export class ObjectSchema< * @returns cloned object schema */ public dependentRequired< - K extends Extract, + K extends string & Extract, D extends Exclude, K>, >( this: this, @@ -512,10 +512,10 @@ export class ObjectSchema< X, M & ( + | Partial> | { [k in D]: SchemaType[k]>; } - | { [k in K]?: never } ), N > { @@ -538,13 +538,13 @@ export class ObjectSchema< * @returns cloned object schema */ public dependentSchemas< - K extends Extract, + K extends string & Extract, S extends AbstractSchema | null>>, >( this: this, key: K, schema: S - ): ObjectSchema> | { [k in K]?: never }), N> { + ): ObjectSchema> | Partial>), N> { return this.clone({ [dependentSchemasSym]: { ...this.#dependentSchemas,