3. implement Readonly<T>

TypeScript
Is this helpful ?

  - accepted / - tried

Readonly<T> returns a type that sets all properties of T to readonly.

Pleaes implement MyReadonly<T> by yourself.

type Foo = {
  a: string
}

const a:Foo = {
  a: 'BFE.dev',
}
a.a = 'bigfrontend.dev'
// OK

const b:MyReadonly<Foo> = {
  a: 'BFE.dev'
}
b.a = 'bigfrontend.dev'
// Error

Let's try to solve this problem within 5 mintues.

Discuss(5)