Improving type narrowing

Is there a better way of doing something like this?
  const isPostOrComment = (
    activity: typeof RawRedditActivity.Type,
  ): activity is typeof RawRedditPost.Type | typeof RawRedditComment.Type =>
    activity.kind === RawRedditPost.fields.kind.literals[0] ||
    activity.kind === RawRedditComment.fields.kind.literals[0];
Was this page helpful?