tXml icon indicating copy to clipboard operation
tXml copied to clipboard

tXml.d.ts

Open moongazers opened this issue 4 years ago • 4 comments

Should the type be

export type tNode = { tagName: string; attributes: object; children: (tNode | string | number)[]; };

?

moongazers avatar Dec 02 '20 07:12 moongazers

strings do not get parsed automatically into numbers. did you find any number? and can share some example?

TobiasNickel avatar Dec 05 '20 23:12 TobiasNickel

Maybe it's due to my poor typescript understanding but 'children' prop in tNode is like

children: ["aaaa", "bbbb"]
children: [
{tagName: "1111", attributes: {...}, children:[...]}
{tagName: "1111", attributes: {...}, children:[...]}
]

Currently tNode type declaration is export type tNode = { tagName: string; attributes: object; children: tNode | string | number[]; }; Should 'children' always be array at least ? Or am I missing sth here... Thanks!

moongazers avatar Dec 07 '20 02:12 moongazers

ahh, yes, the typedefinition should not contain the number. For the children as well as for the parser result. I will take that into the next 4.1 release. I already have one other change I want to release. Will do this at the weekend.

TobiasNickel avatar Dec 08 '20 00:12 TobiasNickel

Thanks Tobias, tXml is such a great lib, the performance is outstanding! Really help our project a lot. Will dig a bit when time permitted :)

moongazers avatar Dec 08 '20 06:12 moongazers