diff --git a/src/types.ts b/src/types.ts index 4719c60..259f62c 100644 --- a/src/types.ts +++ b/src/types.ts @@ -10,8 +10,10 @@ export type IterableElement = TargetIterable extends Iterable< ? ElementType : never; -export type ValueOf> = - ObjectType[string]; +export type ValueOf< + ObjectType, + ValueType extends keyof ObjectType = keyof ObjectType, +> = ObjectType[ValueType]; type Simplify = { [KeyType in keyof T]: T[KeyType] }; type Except = Pick< @@ -141,9 +143,12 @@ export type ModelValue = [P in keyof T["config"]["choices"] as P extends string ? P : never]: T["config"]["choices"][P] extends prismicT.CustomTypeModelSlice - ? CustomTypeModelSliceValue + ? CustomTypeModelSliceValue< + T["config"]["choices"][P], + P extends string ? P : string + > : T["config"]["choices"][P] extends prismicT.CustomTypeModelSharedSlice - ? prismicT.SharedSlice

+ ? prismicT.SharedSlice

: never; }> >