Require optional field in certain case

please advise. I have an interface:

export interface PermissionScope {
  type: string;
  companyId?: number | null;
}

Later, in certain case i want to require companyId field be present. What is the most effective typescriptish way to do it?

Appreciate.