INNER CODE UNIT · TypeScript
isTextElementId
ParthJadhav/app-store-screenshots · skills/app-store-screenshots/template/src/lib/elements.ts:15
export function isTextElementId(id: ElementId | string | null | undefined): id is TextElementId {
return typeof id === "string" && id.startsWith(TEXT_ELEMENT_PREFIX);
}
export function toTextElementId(id: string): TextElementId {
return `${TEXT_ELEMENT_PREFIX}${id}` as TextElementId;
}
export function textElementKey(id: TextElementId | ElementId): string {
return isTextElementId(id) ? id.slice(TEXT_ELEMENT_PREFIX.length) : id;
}