fix typecheck

This commit is contained in:
Frooodle
2026-06-23 16:55:54 +01:00
parent 26d835eda6
commit 4da5b4b7eb
@@ -4,12 +4,7 @@
* without needing to make API calls
*/
// PDF.js types (simplified)
declare global {
interface Window {
pdfjsLib?: any;
}
}
// window.pdfjsLib is declared (narrowly) in formDetection/pdfRender.ts.
export interface SignatureDetectionResult {
hasSignatures: boolean;
@@ -29,8 +24,9 @@ const detectSignaturesInFile = async (
file: File,
): Promise<SignatureDetectionResult> => {
try {
// Ensure PDF.js is available
if (!window.pdfjsLib) {
// pdfRender.ts narrowly types window.pdfjsLib; this service uses more of the API.
const pdfjsLib = window.pdfjsLib as any;
if (!pdfjsLib) {
return {
hasSignatures: false,
error: "PDF.js not available",
@@ -41,8 +37,7 @@ const detectSignaturesInFile = async (
const arrayBuffer = await file.arrayBuffer();
// Load the PDF document
const pdf = await window.pdfjsLib.getDocument({ data: arrayBuffer })
.promise;
const pdf = await pdfjsLib.getDocument({ data: arrayBuffer }).promise;
let totalSignatures = 0;