Skip to content

isCategoryDescriptor

isCategoryDescriptor(value): value is CategoryDescriptor

Accepts an unresolved descriptor too: a category deleted since publish delivers {provider, key, kind: 'category', resolved: false} and none of path, value or groupExternalId, so requiring those would reject the one case this guard most needs to recognize — leaving a caller to branch on something else and render a dangling id.

The kind discriminator is what makes that safe. A descriptor without kind (content published before the discriminator was stamped) is still accepted when it carries path, value and groupExternalId.

unknown

value is CategoryDescriptor