Skip to content

isKnownAttachmentKind

isKnownAttachmentKind(kind): kind is “text” | “native_comments” | “video” | “audio” | “image” | “pdf” | “pdf_embed” | “embed” | “quiz” | “code_display” | “code_embed” | “upsell”

Defined in: v1/schemas.ts:352

Narrows an attachment kind to one this SDK documents.

string

The kind value from a LectureAttachment.

kind is “text” | “native_comments” | “video” | “audio” | “image” | “pdf” | “pdf_embed” | “embed” | “quiz” | “code_display” | “code_embed” | “upsell”

true if the kind appears in KNOWN_LECTURE_ATTACHMENT_KINDS.

for (const attachment of lecture.attachments ?? []) {
if (!isKnownAttachmentKind(attachment.kind)) {
console.warn(`Unrecognised attachment kind: ${attachment.kind}`);
continue;
}
// attachment.kind is narrowed to the known union here
}