Skip to content

Commit

Permalink
Use consistent record type
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobLey committed Nov 1, 2024
1 parent e718f38 commit a7248af
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/olive-zoos-care.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"juniper": patch
---

Use consistent record type
8 changes: 4 additions & 4 deletions apps/juniper/src/schemas/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ export class ObjectSchema<
* @returns cloned object schema
*/
public dependentRequired<
K extends Extract<keyof P, string>,
K extends string & Extract<keyof P, string>,
D extends Exclude<Extract<keyof P, string>, K>,
>(
this: this,
Expand All @@ -512,10 +512,10 @@ export class ObjectSchema<
X,
M &
(
| Partial<Record<K, never>>
| {
[k in D]: SchemaType<StripBooleanParameterSchemaObject<P>[k]>;
}
| { [k in K]?: never }
),
N
> {
Expand All @@ -538,13 +538,13 @@ export class ObjectSchema<
* @returns cloned object schema
*/
public dependentSchemas<
K extends Extract<keyof P, string>,
K extends string & Extract<keyof P, string>,
S extends AbstractSchema<SchemaGenerics<Record<string, unknown> | null>>,
>(
this: this,
key: K,
schema: S
): ObjectSchema<P, R, A, X, M & (NonNullable<SchemaType<S>> | { [k in K]?: never }), N> {
): ObjectSchema<P, R, A, X, M & (NonNullable<SchemaType<S>> | Partial<Record<K, never>>), N> {
return this.clone({
[dependentSchemasSym]: {
...this.#dependentSchemas,
Expand Down

0 comments on commit a7248af

Please sign in to comment.