diff --git a/xml/_types.ts b/xml/_types.ts index a7630ce..d29b61e 100644 --- a/xml/_types.ts +++ b/xml/_types.ts @@ -25,11 +25,11 @@ export type xml_node = { /** XML document. */ export type xml_document = xml_node & { /** XML version. */ - ["@version"]?: string + ["@version"]?: `1.${number}` /** XML character encoding. */ ["@encoding"]?: string /** XML standalone. */ - ["@standalone"]?: string + ["@standalone"]?: "yes" | "no" /** XML doctype. */ ["#doctype"]?: xml_node /** XML instructions. */ diff --git a/xml/_types_test.ts b/xml/_types_test.ts index 0d89806..4abd82d 100644 --- a/xml/_types_test.ts +++ b/xml/_types_test.ts @@ -1 +1,18 @@ import "./_types.ts" +import { stringify } from "./mod.ts" + +// Verify that the generic type is correctly inferred. +const _example = stringify({ + "@version": "1.1", + "@encoding": "UTF-8", + "@standalone": "yes", + "#doctype": { + "~name": "html", + "~children": [], + "#text": "", + }, + "#instructions": {}, + "~name": "html", + "~children": [], + "#text": "", +})