Skip to content

Commit

Permalink
fix(xml): use the type system to verify version
Browse files Browse the repository at this point in the history
Reverts: 78ed4ac
  • Loading branch information
lishaduck committed Jun 9, 2024
1 parent 73a1335 commit bac32c6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions xml/_types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down
2 changes: 2 additions & 0 deletions xml/stringify.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ const internal = Symbol("internal")
* import { stringify } from "./stringify.ts"
*
* console.log(stringify({
* "@version": "1.0",
* "@standalone": "yes",
* root: {
* text: "hello",
* array: ["world", "monde", "涓栫晫", "馃審"],
Expand Down

0 comments on commit bac32c6

Please sign in to comment.