Skip to content

Commit a1adc55

Browse files
committed
fix: satisfy pptx/xlsx typecheck
1 parent 0e3c0d5 commit a1adc55

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

src/pptx.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -689,7 +689,7 @@ export class PPTXConverter implements Converter {
689689
// Regular paragraph
690690
formattedContent.push({
691691
text: line,
692-
options: { paragraph: true },
692+
options: {},
693693
});
694694
}
695695
}
@@ -699,8 +699,10 @@ export class PPTXConverter implements Converter {
699699

700700
private extractText(run: OSFTextRun): string {
701701
if (typeof run === 'string') return run;
702-
if (run.type === 'link') return run.text;
703-
if (run.type === 'image') return run.alt || '';
702+
if (typeof run === 'object' && run !== null && 'type' in run) {
703+
if (run.type === 'link') return run.text;
704+
if (run.type === 'image') return run.alt || '';
705+
}
704706
if ('text' in run && typeof run.text === 'string') return run.text;
705707
return '';
706708
}

src/xlsx.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,10 @@ export class XLSXConverter implements Converter {
471471

472472
private extractText(run: OSFTextRun): string {
473473
if (typeof run === 'string') return run;
474-
if (run.type === 'link') return run.text;
475-
if (run.type === 'image') return run.alt || '';
474+
if (typeof run === 'object' && run !== null && 'type' in run) {
475+
if (run.type === 'link') return run.text;
476+
if (run.type === 'image') return run.alt || '';
477+
}
476478
if ('text' in run && typeof run.text === 'string') return run.text;
477479
return '';
478480
}

0 commit comments

Comments
 (0)