1

I need to write the correct typescript type for an object having the following form:

{
  authority: 'stringA',
  moduleA: { authority: 'stringB', submoduleA: {authority: 'stringC'} },
  moduleB: { authority: 'stringD' }
}

I imagine the following type:

type Permissions = {
  authority: string,
  [key: string]: Permissions
}

But it's incorrect in typescript. How to do it correctly?

luski
  • 11
  • 1

0 Answers0