fix: incorrect node parser implementations (#428)

These were causing some issues in v5.2.0.
This commit is contained in:
LuanRT
2023-07-03 21:58:00 -03:00
committed by GitHub
parent 83cbfd631b
commit 222dfce6bb
13 changed files with 131 additions and 78 deletions

View File

@@ -1,20 +1,25 @@
import { YTNode } from '../helpers.js';
import Parser, { type RawNode } from '../index.js';
import ContinuationItem from './ContinuationItem.js';
import EngagementPanelTitleHeader from './EngagementPanelTitleHeader.js';
import SectionList from './SectionList.js';
import StructuredDescriptionContent from './StructuredDescriptionContent.js';
export default class EngagementPanelSectionList extends YTNode {
static type = 'EngagementPanelSectionList';
target_id: String;
content?: SectionList|ContinuationItem|StructuredDescriptionContent;
header: EngagementPanelTitleHeader | null;
content: SectionList | ContinuationItem | StructuredDescriptionContent | null;
target_id?: string;
panel_identifier?: string;
visibility?: string;
constructor(data: RawNode) {
super();
this.header = Parser.parseItem(data.header, EngagementPanelTitleHeader);
this.content = Parser.parseItem(data.content, [ SectionList, ContinuationItem, StructuredDescriptionContent ]);
this.panel_identifier = data.panelIdentifier;
this.target_id = data.targetId;
const content = Parser.parseItem(data.content, [ SectionList, ContinuationItem, StructuredDescriptionContent ]);
if (content !== null) {
this.content = content;
}
this.visibility = data.visibility;
}
}