plastikfan / xiberia

Type only library that declares types for xml/regular expression based FS ecosystem
MIT License
0 stars 0 forks source link

Define initial types to export #2

Open plastikfan opened 4 years ago

plastikfan commented 4 years ago

Interface types that are 'shared' between jaxom-ts & zenobia-ts need to be in an alternative package. The reason for this is, if another implementation is developed that replicates jaxom in some other way, there should be no dependency of this alternative implementation on jaxom-ts. The best solution would be for these types to be declared elsewhere. Can we and does it male sense to have a package just for types? And can we define these in DefinitelyTyped (perhaps as @types/)? According to DefinitelyTyped, it is Ok to define modules that have types only; these are called 'Ghost modules' or 'non-instantiated modules' (https://definitelytyped.org/guides/best-practices.html).

See: https://devblogs.microsoft.com/typescript/writing-dts-files-for-types/ and https://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html But note, this should not done until jaxom-ts is well tested and we know for sure what the types should be and thus fit for being published.

Due to the perceived bearocracy in forking DefinitelyTyped (ie waiting for pull requuest to be processed), I tought it would be best to just define a stand alone npm package that simply exports types. This way, I never need to be waiting on a 3rd party to complete tasks. I would rather use DT, because that would mean the user could idomatically install @types/xeno. Instead the user will have to simply install "zeno", but it is not immediately obvious that you're just getting types.

plastikfan commented 4 years ago

As a result of a useful twitter exchange with Daniel Rosenwasser, the writer of the microsoft blog article (previously quoted), I have decided that there's no need to go down the route of submitting types to DefinitelyTyped. A new self contained type only package 'Xeno' will be developed instead.