22 lines
776 B
TypeScript
22 lines
776 B
TypeScript
export const TASK_DETAIL_SOURCE_TYPE_OPTIONS = ['实拍', '渲染', 'AI'] as const
|
|
|
|
export type TaskDetailSourceType = (typeof TASK_DETAIL_SOURCE_TYPE_OPTIONS)[number]
|
|
|
|
export function isTaskDetailSourceType(value: unknown): value is TaskDetailSourceType {
|
|
return TASK_DETAIL_SOURCE_TYPE_OPTIONS.includes(value as TaskDetailSourceType)
|
|
}
|
|
|
|
export function normalizeTaskDetailSourceType(value: unknown): TaskDetailSourceType | null {
|
|
const normalized = typeof value === 'string' ? value.trim() : ''
|
|
if (!normalized) {
|
|
return null
|
|
}
|
|
|
|
return isTaskDetailSourceType(normalized) ? normalized : null
|
|
}
|
|
|
|
export function getTaskDetailSourceTypeLabel(value: unknown): string {
|
|
const normalized = normalizeTaskDetailSourceType(value)
|
|
return normalized || '未设置'
|
|
}
|