oozcitak / xmlbuilder-js

An XML builder for node.js
MIT License
918 stars 107 forks source link

typings are full of errors #211

Closed sandersn closed 5 years ago

sandersn commented 5 years ago

Discovered in Definitely Typed: the plist typings depend on xmlbuilder. However, any Typescript code (or checked Javascript code) that depends on xmlbuilder will now have these errors. I'd recommend adding a call to tsc typings/index.d.ts to the CI run somewhere.

  1. The import syntax for 'stream' should be import { Writable } from 'stream';.
  2. abstract class XMLCharacterData seems to be referred to as CharacterData in the rest of the file.
  3. XMLDocType incorrectly extends XMLNode — you can't return a subtype in an override, and many methods do this.

(1) and (2) have easy, obvious fixes. (3) I'm not so sure about -- probably XMLNode just needs to return this. Either way, I'll have a PR up shortly.

sandersn commented 5 years ago

(2) might be intending to extend the built-in CharacterData but I think this is really unlikely.

sandersn commented 5 years ago

I think for (3), the base class, XMLNode, needs to have its methods return XMLNode.