Question: I have proptypes shown below

```
interface Props {
resource: string;
create?: boolean;
route?: string;
}

```

As can be seen above, create and route are optional props. However, I would like to implement the types such that if create prop is present then route must now be required. Anyone have any ideas how to do this?

Answer: 
You should group these props and make that grouped prop optional as

```
interface RouteProps{
create: boolean;
route: string;
}

interface Props {
resource: string;
routeInfo?: RouteProps;
}

```
You can split it into a union of two types and use `create` with a literal type:

```
type Props = {
  resource: string;
  create?: false;
  route?: string
} | {
  resource: string;
  create: true;
  route: string;
}

```