diff --git a/types/inferschematype.d.ts b/types/inferschematype.d.ts index a34c355f49..d73ad4cb81 100644 --- a/types/inferschematype.d.ts +++ b/types/inferschematype.d.ts @@ -146,9 +146,10 @@ type RequiredPathKeys = { * @param {TypeKey} TypeKey A generic of literal string type."Refers to the property used for path type definition". * @returns a record contains required paths with the corresponding type. */ -type RequiredPaths = { - [K in RequiredPathKeys]: T[K]; -}; +type RequiredPaths = Pick< + { -readonly [K in keyof T]: T[K] }, + RequiredPathKeys +>; /** * @summary A Utility to obtain schema's optional path keys. @@ -166,9 +167,10 @@ type OptionalPathKeys = { * @param {TypeKey} TypeKey A generic of literal string type."Refers to the property used for path type definition". * @returns a record contains optional paths with the corresponding type. */ -type OptionalPaths = { - [K in OptionalPathKeys]?: T[K]; -}; +type OptionalPaths = Pick< + { -readonly [K in keyof T]?: T[K] }, + OptionalPathKeys +>; /** * @summary Allows users to optionally choose their own type for a schema field for stronger typing.