Omit key recursively?

I have a type that references itself.
type TParseObject<T>={
  [key in keyof T]?: string | TParseObject<T>
};

So for example
type Foo = ['a', 'b', 'c']
const Bar: TParseObject<Foo> = {
  a: {
    b: 'ok',
    c:{
      b: 'not ok'
    }
  }
}

How can I recursively omit keys such that nested objects can only contain unused ones?
Was this page helpful?