Skip to content
RED SAG Skills
mediumStudy question · answer published in TypeScript interview questions, so no pointsjavascripttypescriptnarrowing

A function that narrows a type

What does the return type value is ApiError do here?

function isApiError(value: unknown): value is ApiError {
  return typeof value === "object" && value !== null && "code" in value
}
Choose one answer

Discussion 0

Join free to post in the discussion.

Related questions