질문

interface IExample {
  a?: boolean;
  b: string;
}

이런 interface가 있을때 a 값이 true 일때만 b가 required되게 할 수 있을까요?

type IExample = (
  | {
    a: true,
    b: string,
  }
  | {
    a?: false,
    b?: string,
  }
);