refactor: fix type errors and improve type safety in PDF logic

- Add proper type assertions for DOM element properties
- Remove unused md-to-pdf feature
- Fix type errors in various PDF manipulation functions
- Improve type safety for HTML element interactions
This commit is contained in:
abdullahalam123 committed 2025-10-17 15:01:48 +05:30
1 parent 298135ab0d
commit cc83d7951f
18 files changed
+1033 -729

No files matched your search

+13 -11
View File
@@ -9,27 +9,29 @@ export function setupFixDimensionsUI() {
const customSizeWrapper = document.getElementById('custom-size-wrapper');
if (targetSizeSelect && customSizeWrapper) {
targetSizeSelect.addEventListener('change', () => {
// @ts-expect-error TS(2339) FIXME: Property 'value' does not exist on type 'HTMLEleme... Remove this comment to see the full error message
customSizeWrapper.classList.toggle(
'hidden',
targetSizeSelect.value !== 'Custom'
(targetSizeSelect as HTMLSelectElement).value !== 'Custom'
);
});
}
}
export async function fixDimensions() {
// @ts-expect-error TS(2339) FIXME: Property 'value' does not exist on type 'HTMLEleme... Remove this comment to see the full error message
const targetSizeKey = document.getElementById('target-size').value;
// @ts-expect-error TS(2339) FIXME: Property 'value' does not exist on type 'HTMLEleme... Remove this comment to see the full error message
const orientation = document.getElementById('orientation').value;
// @ts-expect-error TS(2339) FIXME: Property 'value' does not exist on type 'Element'.
const scalingMode = document.querySelector(
'input[name="scaling-mode"]:checked'
const targetSizeKey = (
document.getElementById('target-size') as HTMLSelectElement
).value;
const orientation = (
document.getElementById('orientation') as HTMLSelectElement
).value;
const scalingMode = (
document.querySelector(
'input[name="scaling-mode"]:checked'
) as HTMLInputElement
).value;
// @ts-expect-error TS(2339) FIXME: Property 'value' does not exist on type 'HTMLEleme... Remove this comment to see the full error message
const backgroundColor = hexToRgb(
document.getElementById('background-color').value
(document.getElementById('background-color') as HTMLInputElement).value
);
showLoader('Standardizing pages...');