TypeScript declaration is wrong in CommonJS
The .d.ts file exports a default class, which makes TypeScript look for a .default property on the exports object in CommonJS. However, in CommonJS environments, the exports object is set to the class itself. This makes it unusable in Node.js/TypeScript projects.
You can fix by telling rollup to force default export but this will make people need require("x").default but if you don't do this it will happen as soon as someone adds a named export
I think if we want interop it is best to avoid module.exports assignment altogether
@krisselden I agree. Personally, I don't mind having to do .default in Node, but that may be a minority opinion.
Is there a change this being merged in for a new version?
I was really hoping to use this lib in one of my project, because I was sure I could share code between frontend and backend, but I guess I was wrong :(
FWIW this is now solved by typescript with the allowSyntheticDefaultImports option, otherwise the typedef matches the module build