diff --git a/libs/typescript/src/daletl/main.ts b/libs/typescript/src/daletl/main.ts index 6a41b04..4c0b909 100644 --- a/libs/typescript/src/daletl/main.ts +++ b/libs/typescript/src/daletl/main.ts @@ -11,6 +11,10 @@ export function parseBody(body: Body): CommonBody { return null; } + if (typeof body === "string") { + return body; + } + return body.map((t) => parseTag(t)); } diff --git a/libs/typescript/src/daletl/types.ts b/libs/typescript/src/daletl/types.ts index 2b5abd4..2b29770 100644 --- a/libs/typescript/src/daletl/types.ts +++ b/libs/typescript/src/daletl/types.ts @@ -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; diff --git a/libs/typescript/src/utils.ts b/libs/typescript/src/utils.ts index 9c9408c..8b6fd03 100644 --- a/libs/typescript/src/utils.ts +++ b/libs/typescript/src/utils.ts @@ -5,6 +5,10 @@ export function bodyToRaw(body: CommonBody): Body { return null; } + if (typeof body === "string") { + return body; + } + return body.map((t) => t.raw); }