Back

Advanced Types / Custom Readonly

00:00
1/20

Custom Readonly

Hard

'Implement a mapped type MyReadonly<T> that behaves like the built-in Readonly<T>.'

  • 1

    `

  • 2

    Use the syntax `{ readonly [P in keyof T]: T[P]

TYPESCRIPT PLAYGROUND
TYPESCRIPT PLAYGROUND
⏳ Loading editor…