typescript
This commit is contained in:
@@ -1,18 +1,14 @@
|
||||
import { openOcrTextInNewTab } from '../utils/ocr';
|
||||
import type {
|
||||
EnsureAssetUrl,
|
||||
EnsurePreviewData,
|
||||
GetDocumentAsset,
|
||||
DocumentLike as OcrDocumentLike,
|
||||
} from '../utils/ocr';
|
||||
|
||||
type ResolveApiPath = (path: string) => string;
|
||||
type EnsurePreviewData = (id: string | number) => Promise<void>;
|
||||
type EnsureAssetUrl = (id: string | number, asset: unknown, options?: unknown) => Promise<unknown>;
|
||||
type GetDocumentAsset = (document: DocumentLike, type: string) => unknown;
|
||||
|
||||
interface DocumentVersion {
|
||||
download_path?: string | null;
|
||||
}
|
||||
|
||||
export interface DocumentLike {
|
||||
id?: string | number;
|
||||
current_version?: DocumentVersion | null;
|
||||
}
|
||||
export type DocumentLike = OcrDocumentLike;
|
||||
|
||||
const asyncFalse = async () => false;
|
||||
|
||||
@@ -20,7 +16,7 @@ const resolveDocumentDownloadHref = (document: DocumentLike | null | undefined,
|
||||
if (!document || !resolveApiPath) {
|
||||
return null;
|
||||
}
|
||||
const downloadPath = document.current_version?.download_path;
|
||||
const downloadPath = (document.current_version as { download_path?: string | null } | null | undefined)?.download_path;
|
||||
if (!downloadPath) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user