@@ -146,9 +146,10 @@ type RequiredPathKeys<T, TypeKey extends string = DefaultTypeKey> = {
146146 * @param {TypeKey } TypeKey A generic of literal string type."Refers to the property used for path type definition".
147147 * @returns a record contains required paths with the corresponding type.
148148 */
149- type RequiredPaths < T , TypeKey extends string = DefaultTypeKey > = {
150- [ K in RequiredPathKeys < T , TypeKey > ] : T [ K ] ;
151- } ;
149+ type RequiredPaths < T , TypeKey extends string = DefaultTypeKey > = Pick <
150+ { - readonly [ K in keyof T ] : T [ K ] } ,
151+ RequiredPathKeys < T , TypeKey >
152+ > ;
152153
153154/**
154155 * @summary A Utility to obtain schema's optional path keys.
@@ -166,9 +167,10 @@ type OptionalPathKeys<T, TypeKey extends string = DefaultTypeKey> = {
166167 * @param {TypeKey } TypeKey A generic of literal string type."Refers to the property used for path type definition".
167168 * @returns a record contains optional paths with the corresponding type.
168169 */
169- type OptionalPaths < T , TypeKey extends string = DefaultTypeKey > = {
170- [ K in OptionalPathKeys < T , TypeKey > ] ?: T [ K ] ;
171- } ;
170+ type OptionalPaths < T , TypeKey extends string = DefaultTypeKey > = Pick <
171+ { - readonly [ K in keyof T ] ?: T [ K ] } ,
172+ OptionalPathKeys < T , TypeKey >
173+ > ;
172174
173175/**
174176 * @summary Allows users to optionally choose their own type for a schema field for stronger typing.
0 commit comments