Skip to content

Commit

Permalink
Fix issue 11 (when "strictNullChecks": false in tsconfig.json is ca…
Browse files Browse the repository at this point in the history
…uses a bugs)
  • Loading branch information
iamguid committed Mar 13, 2024
1 parent dc19898 commit 44e1087
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dist/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ declare type OnlyKeys<T> = {
[key in keyof T]-?: any;
};
declare type FormModelKeyofTraverse<TModel extends Record<string, any>, TAnnotations extends (OnlyKeys<TModel> | FormElementType)> = {
[key in keyof OnlyKeys<TModel>]: FormModelInnerTraverse<TModel[key], TAnnotations extends OnlyKeys<TModel>[key] ? TAnnotations[key] : TAnnotations>;
[key in keyof OnlyKeys<TModel>]: FormModelInnerTraverse<TModel[key], TAnnotations extends OnlyKeys<TModel>[key] ? unknown extends TAnnotations[key] ? FormElementControl : TAnnotations[key] : TAnnotations>;
};
declare type FormModelInnerTraverse<TModel, TAnnotations> = TAnnotations extends null ? TModel extends Array<any> ? FormModelInnerTraverse<TModel, FormElementArray> : TModel extends Record<string, any> ? FormModelInnerTraverse<TModel, FormElementGroup> : FormModelInnerTraverse<TModel, FormElementControl> : TAnnotations extends FormElementArray ? TModel extends Array<infer TInferredArrayValueType> ? FormArray<FormControl<TInferredArrayValueType>> : never : TAnnotations extends FormElementGroup ? TModel extends Record<string, any> ? FormGroup<FormModelKeyofTraverse<TModel, FormElementGroup>> : never : TAnnotations extends FormElementControl ? FormControl<TModel> : TAnnotations extends Replace<infer TInferredReplace> ? TInferredReplace : TAnnotations extends Array<infer TInferedAnnotations> ? TModel extends Array<infer TInferedArrayType> ? FormArray<FormModelInnerTraverse<TInferedArrayType, TInferedAnnotations>> : never : TAnnotations extends Record<string, any> ? TModel extends Record<string, any> ? FormGroup<FormModelKeyofTraverse<TModel, TAnnotations>> : never : FormModelInnerTraverse<TModel, FormElementControl>;
export {};
Expand Down
2 changes: 1 addition & 1 deletion dist/src/index.d.ts.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 5 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ type FormModelKeyofTraverse<
[key in keyof OnlyKeys<TModel>]:
FormModelInnerTraverse<
TModel[key],
TAnnotations extends OnlyKeys<TModel>[key] ? TAnnotations[key] : TAnnotations
TAnnotations extends OnlyKeys<TModel>[key]
? unknown extends TAnnotations[key]
? FormElementControl
: TAnnotations[key]
: TAnnotations
>
}

Expand Down

0 comments on commit 44e1087

Please sign in to comment.