fix(ts): main,utils

This commit is contained in:
Artemy Egorov 2024-07-28 22:33:07 +03:00
parent 1626ef38eb
commit 581a7a97cc
3 changed files with 9 additions and 1 deletions

View file

@ -11,6 +11,10 @@ export function parseBody(body: Body): CommonBody {
return null; return null;
} }
if (typeof body === "string") {
return body;
}
return body.map((t) => parseTag(t)); return body.map((t) => parseTag(t));
} }

View file

@ -43,6 +43,6 @@ export abstract class CommonTag {
} }
} }
export type CommonBody = CommonTag[] | null; export type CommonBody = string | CommonTag[] | null;
export type TagNormalizer = (tag: Tag) => CommonTag; export type TagNormalizer = (tag: Tag) => CommonTag;

View file

@ -5,6 +5,10 @@ export function bodyToRaw(body: CommonBody): Body {
return null; return null;
} }
if (typeof body === "string") {
return body;
}
return body.map((t) => t.raw); return body.map((t) => t.raw);
} }