refactor: migrate parsers to TS (#133)

* dev: finish top-level parsers TS migration

* dev: migrate menu renderers to TS

* chore: fix ts errors

* dev: finish ts migration 🎉
This commit is contained in:
LuanRT
2022-08-20 03:18:17 -03:00
committed by GitHub
parent b101a39d30
commit 34281e2445
206 changed files with 1747 additions and 608 deletions

View File

@@ -3,7 +3,7 @@ import Button from '../Button';
class MenuNavigationItem extends Button {
static type = 'MenuNavigationItem';
constructor(data) {
constructor(data: any) {
super(data);
}
}

View File

@@ -3,7 +3,7 @@ import Button from '../Button';
class MenuServiceItem extends Button {
static type = 'MenuServiceItem';
constructor(data) {
constructor(data: any) {
super(data);
}
}

View File

@@ -4,7 +4,10 @@ import { YTNode } from '../../helpers';
class MenuServiceItemDownload extends YTNode {
static type = 'MenuServiceItemDownload';
constructor(data) {
has_separator: boolean;
endpoint: NavigationEndpoint;
constructor(data: any) {
super();
this.has_separator = data.hasSeparator;
this.endpoint = new NavigationEndpoint(data.navigationEndpoint || data.serviceEndpoint);

View File

@@ -4,7 +4,11 @@ import { YTNode } from '../../helpers';
class MultiPageMenu extends YTNode {
static type = 'MultiPageMenu';
constructor(data) {
header;
sections;
style: string;
constructor(data: any) {
super();
this.header = Parser.parse(data.header);
this.sections = Parser.parse(data.sections);

View File

@@ -4,7 +4,9 @@ import { YTNode } from '../../helpers';
class MultiPageMenuNotificationSection extends YTNode {
static type = 'MultiPageMenuNotificationSection';
constructor(data) {
items;
constructor(data: any) {
super();
this.items = Parser.parse(data.items);
}

View File

@@ -5,7 +5,10 @@ import { YTNode } from '../../helpers';
class SimpleMenuHeader extends YTNode {
static type = 'SimpleMenuHeader';
constructor(data) {
title: Text;
buttons;
constructor(data: any) {
super();
this.title = new Text(data.title);
this.buttons = Parser.parse(data.buttons);