diff --git a/src/type/indexed/indexed-from-mapped-result.ts b/src/type/indexed/indexed-from-mapped-result.ts index 136e7a1b..e2b2b007 100644 --- a/src/type/indexed/indexed-from-mapped-result.ts +++ b/src/type/indexed/indexed-from-mapped-result.ts @@ -36,17 +36,11 @@ import { Index, type TIndex } from './index' // FromProperties // ------------------------------------------------------------------ // prettier-ignore -type TFromProperties< - Type extends TSchema, - Properties extends TProperties -> = ( +type TFromProperties = ( { [K2 in keyof Properties]: TIndex> } ) // prettier-ignore -function FromProperties< - Type extends TSchema, - Properties extends TProperties ->(type: Type, properties: Properties, options?: SchemaOptions): TFromProperties { +function FromProperties(type: Type, properties: Properties, options?: SchemaOptions): TFromProperties { const result = {} as Record for(const K2 of Object.getOwnPropertyNames(properties)) { const keys = IndexPropertyKeys(properties[K2]) @@ -58,36 +52,26 @@ function FromProperties< // FromMappedResult // ------------------------------------------------------------------ // prettier-ignore -type TFromMappedResult< - T extends TSchema, - R extends TMappedResult -> = ( - TFromProperties +type TFromMappedResult = ( + TFromProperties ) // prettier-ignore -function FromMappedResult< - T extends TSchema, - R extends TMappedResult ->(T: T, R: R, options?: SchemaOptions): TFromMappedResult { - return FromProperties(T, R.properties, options) as never +function FromMappedResult(type: Type, mappedResult: MappedResult, options?: SchemaOptions): TFromMappedResult { + return FromProperties(type, mappedResult.properties, options) as never } // ------------------------------------------------------------------ // TIndexFromMappedResult // ------------------------------------------------------------------ // prettier-ignore -export type TIndexFromMappedResult< - T extends TSchema, - R extends TMappedResult, - P extends TProperties = TFromMappedResult +export type TIndexFromMappedResult > = ( - TMappedResult

+ TMappedResult ) // prettier-ignore -export function IndexFromMappedResult< - T extends TSchema, - R extends TMappedResult, - P extends TProperties = TFromMappedResult ->(T: T, R: R, options?: SchemaOptions): TMappedResult

{ - const P = FromMappedResult(T, R, options) - return MappedResult(P) as never +export function IndexFromMappedResult +>(type: Type, mappedResult: MappedResult, options?: SchemaOptions): TMappedResult { + const properties = FromMappedResult(type, mappedResult, options) + return MappedResult(properties) as never }