@amityco/ts-sdk
Version:
Amity Social Cloud Typescript SDK
28 lines (25 loc) • 711 B
text/typescript
export function isAmityImagePost(post: Amity.InternalPost): post is Amity.Post<'image'> {
return !!(
post.data &&
typeof post.data !== 'string' &&
'fileId' in post.data &&
post.dataType === 'image'
);
}
export function isAmityFilePost(post: Amity.InternalPost): post is Amity.Post<'file'> {
return !!(
post.data &&
typeof post.data !== 'string' &&
'fileId' in post.data &&
post.dataType === 'file'
);
}
export function isAmityVideoPost(post: Amity.InternalPost): post is Amity.Post<'video'> {
return !!(
post.data &&
typeof post.data !== 'string' &&
'videoFileId' in post.data &&
'thumbnailFileId' in post.data &&
post.dataType === 'video'
);
}