From 0b73702bdd7870c793aa4097932267059fe88922 Mon Sep 17 00:00:00 2001 From: Luan Date: Sat, 14 Dec 2024 12:41:24 -0300 Subject: [PATCH] chore(HowThisWasMadeSectionView): Make some fields optional Just in case. --- src/parser/classes/HowThisWasMadeSectionView.ts | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/parser/classes/HowThisWasMadeSectionView.ts b/src/parser/classes/HowThisWasMadeSectionView.ts index 72f31524..95c0f7db 100644 --- a/src/parser/classes/HowThisWasMadeSectionView.ts +++ b/src/parser/classes/HowThisWasMadeSectionView.ts @@ -5,14 +5,17 @@ import Text from './misc/Text.js'; export default class HowThisWasMadeSectionView extends YTNode { static type = 'HowThisWasMadeSectionView'; - public section_title: Text; - public body_text: Text; - public body_header: Text; + public section_title?: Text; + public body_text?: Text; + public body_header?: Text; constructor(data: RawNode) { super(); - this.section_title = Text.fromAttributed(data.sectionText); - this.body_text = Text.fromAttributed(data.bodyText); - this.body_header = Text.fromAttributed(data.bodyHeader); + if (Reflect.has(data, 'sectionText')) + this.section_title = Text.fromAttributed(data.sectionText); + if (Reflect.has(data, 'bodyText')) + this.body_text = Text.fromAttributed(data.bodyText); + if (Reflect.has(data, 'bodyHeader')) + this.body_header = Text.fromAttributed(data.bodyHeader); } } \ No newline at end of file