Use dangerousIsType
This commit is contained in:
@@ -27,6 +27,7 @@ import {Link} from '#/components/Link'
|
|||||||
import {MediaInsetBorder} from '#/components/MediaInsetBorder'
|
import {MediaInsetBorder} from '#/components/MediaInsetBorder'
|
||||||
import * as Hider from '#/components/moderation/Hider'
|
import * as Hider from '#/components/moderation/Hider'
|
||||||
import {Text} from '#/components/Typography'
|
import {Text} from '#/components/Typography'
|
||||||
|
import * as atp from '#/types/atproto'
|
||||||
|
|
||||||
function getBlackColor(t: ReturnType<typeof useTheme>) {
|
function getBlackColor(t: ReturnType<typeof useTheme>) {
|
||||||
return select(t.name, {
|
return select(t.name, {
|
||||||
@@ -78,7 +79,12 @@ export function VideoPostCard({
|
|||||||
if (!AppBskyEmbedVideo.isView(embed)) return null
|
if (!AppBskyEmbedVideo.isView(embed)) return null
|
||||||
|
|
||||||
const author = post.author
|
const author = post.author
|
||||||
const text = AppBskyFeedPost.isRecord(post.record) ? post.record?.text : ''
|
const text = atp.dangerousIsType<AppBskyFeedPost.Record>(
|
||||||
|
post.record,
|
||||||
|
AppBskyFeedPost.isRecord,
|
||||||
|
)
|
||||||
|
? post.record?.text
|
||||||
|
: ''
|
||||||
const likeCount = post?.likeCount ?? 0
|
const likeCount = post?.likeCount ?? 0
|
||||||
const repostCount = post?.repostCount ?? 0
|
const repostCount = post?.repostCount ?? 0
|
||||||
const {thumbnail} = embed
|
const {thumbnail} = embed
|
||||||
|
|||||||
Reference in New Issue
Block a user