Skip to content

Commit

Permalink
πŸ“ [docs]: Fix Condition docs export
Browse files Browse the repository at this point in the history
  • Loading branch information
brunotot committed Sep 17, 2023
1 parent a12795b commit 7a62073
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 14 deletions.
2 changes: 0 additions & 2 deletions packages/core/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import {
getClassFieldNames,
} from "./src/reflection/service/reflection.service";
import TdvCore from "./src/types";
import Condition from "./src/types/namespace/condition.namespace";
import Validation from "./src/types/namespace/validation.namespace";
import Class from "./src/types/validation/class.type";
import DetailedErrors from "./src/types/validation/detailed-errors.type";
Expand All @@ -45,7 +44,6 @@ export interface PrimitiveSetAppend {}

export type {
Class,
Condition,
Decorator,
DecoratorContext,
DecoratorContextMetadata,
Expand Down
18 changes: 6 additions & 12 deletions packages/react/src/hooks/useForm/types.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import { Dispatch, SetStateAction } from "react";
import {
Condition,
DetailedErrors,
Errors,
TdvCore,
Validation,
} from "tdv-core";
import { DetailedErrors, Errors, TdvCore, Validation } from "tdv-core";
import FormContextNamespace from "../../contexts/FormContext/types";

namespace UseFormHook {
Expand Down Expand Up @@ -59,16 +53,16 @@ namespace UseFormHook {
// prettier-ignore
export type PayloadFieldPathEvaluator<T> = {
[K in keyof T]-?: K extends string
? Condition.isFunction<T[K]> extends true ? never :
Condition.isArray<T[K]> extends true ? K :
Condition.isObject<T[K]> extends true ? ObjectPathEvaluator<T, K> :
? TdvCore.Condition.isFunction<T[K]> extends true ? never :
TdvCore.Condition.isArray<T[K]> extends true ? K :
TdvCore.Condition.isObject<T[K]> extends true ? ObjectPathEvaluator<T, K> :
K extends TdvCore.Objects.Inputs<T> ? K : never : never;
}

// prettier-ignore
export type PayloadFieldPath<T> =
Condition.isFunction<T> extends true ? '' :
Condition.isObject<T> extends true ? PayloadFieldPathEvaluator<T>[keyof T] : '';
TdvCore.Condition.isFunction<T> extends true ? '' :
TdvCore.Condition.isObject<T> extends true ? PayloadFieldPathEvaluator<T>[keyof T] : '';
}

export default UseFormHook;

0 comments on commit 7a62073

Please sign in to comment.