diff --git a/dist/src/index.d.ts b/dist/src/index.d.ts index baf0b25..811341d 100644 --- a/dist/src/index.d.ts +++ b/dist/src/index.d.ts @@ -17,7 +17,7 @@ declare type OnlyKeys = { [key in keyof T]-?: any; }; declare type FormModelKeyofTraverse, TAnnotations extends (OnlyKeys | FormElementType)> = { - [key in keyof OnlyKeys]: FormModelInnerTraverse[key] ? TAnnotations[key] : TAnnotations>; + [key in keyof OnlyKeys]: FormModelInnerTraverse[key] ? unknown extends TAnnotations[key] ? FormElementControl : TAnnotations[key] : TAnnotations>; }; declare type FormModelInnerTraverse = TAnnotations extends null ? TModel extends Array ? FormModelInnerTraverse : TModel extends Record ? FormModelInnerTraverse : FormModelInnerTraverse : TAnnotations extends FormElementArray ? TModel extends Array ? FormArray> : never : TAnnotations extends FormElementGroup ? TModel extends Record ? FormGroup> : never : TAnnotations extends FormElementControl ? FormControl : TAnnotations extends Replace ? TInferredReplace : TAnnotations extends Array ? TModel extends Array ? FormArray> : never : TAnnotations extends Record ? TModel extends Record ? FormGroup> : never : FormModelInnerTraverse; export {}; diff --git a/dist/src/index.d.ts.map b/dist/src/index.d.ts.map index a81976a..42a0307 100644 --- a/dist/src/index.d.ts.map +++ b/dist/src/index.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,SAAS,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAGpF,oBAAY,SAAS,CACnB,MAAM,EACN,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,IACpD,sBAAsB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;AAGhD,oBAAY,OAAO,CAAC,CAAC,SAAS,eAAe,IAAI,CAAC,GAAG;IAAE,WAAW,EAAE,aAAa,CAAA;CAAE,CAAC;AAGpF,oBAAY,kBAAkB,GAAG;IAAE,WAAW,E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B,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC,GAC3D,KAAK,GAMT,YAAY,SAAS,kBAAkB,GACrC,WAAW,CAAC,MAAM,CAAC,GAMrB,YAAY,SAAS,OAAO,CAAC,MAAM,gBAAgB,CAAC,GAClD,gBAAgB,GAOlB,YAAY,SAAS,KAAK,CAAC,MAAM,mBAAmB,CAAC,GACnD,MAAM,SAAS,KAAK,CAAC,MAAM,iBAAiB,CAAC,GAC3C,SAAS,CAAC,sBAAsB,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC,GACzE,KAAK,GAOT,YAAY,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GACtC,MAAM,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAChC,SAAS,CAAC,sBAAsB,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC,GACvD,KAAK,GAGT,sBAAsB,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAA"} \ No newline at end of file diff --git a/src/index.ts b/src/index.ts index 976a9bf..2f32373 100644 --- a/src/index.ts +++ b/src/index.ts @@ -28,7 +28,11 @@ type FormModelKeyofTraverse< [key in keyof OnlyKeys]: FormModelInnerTraverse< TModel[key], - TAnnotations extends OnlyKeys[key] ? TAnnotations[key] : TAnnotations + TAnnotations extends OnlyKeys[key] + ? unknown extends TAnnotations[key] + ? FormElementControl + : TAnnotations[key] + : TAnnotations > }