arethetypeswrong / arethetypeswrong.github.io

Tool for analyzing TypeScript types of npm packages

Home Page:https://arethetypeswrong.github.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

What to do for missing export = when it's TypeScript's fault (kinda)

benasher44 opened this issue · comments

ajv is an example of a package that uses TypeScript, but the generated .d.ts by TypeScript suffers from the missing export = issue (extra .default is needed when imported with NodeNext).

As a workaround, I'm opening a PR to their library to explicitly export the Ajv class, but I wasn't able to figure out the settings needed to get TypeScript to generate a better .d.ts. It would be great to update the docs to cover that case.

Actually I see you commented on that issue. I have some follow up questions. I'll follow up on that ticket.

The source of the issue there, as far as declaration file correctness goes, is that the TS contains some direct module.exports manipulation, which the type system / TS module system doesn’t track.