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.
Parameters
Section titled “Parameters”string
The kind value from a LectureAttachment.
Returns
Section titled “Returns”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.
Example
Section titled “Example”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}