sajad torkamani
type MyReadonly<Type> = {
  readonly [Key in keyof Type]: Type[Key]
}
  • Create a mapped type where you assign the readonly modifier to each property.

TS Playground

Tagged:

Leave a comment

Your email address will not be published. Required fields are marked *