pinojs / pino-elasticsearch

🌲 load pino logs into Elasticsearch
MIT License
179 stars 67 forks source link

fix(types): use type export matching module.exports #173

Open ZwaarContrast opened 1 year ago

ZwaarContrast commented 1 year ago

The type in lib.d.ts uses export default where the lib.js file uses module.exports =. This will cause TypeScript under the node16 and nodenext module resolution mode to think an extra .default property access is required, but that will fail at runtime. This type should use export = instead of export default.

Further reading about the specifics of the issue can be found here: https://github.com/arethetypeswrong/arethetypeswrong.github.io/blob/main/docs/problems/FalseExportDefault.md

This pull request aims to fix import issues for Typescript projects using --moduleResolution node16 or nodenext

ZwaarContrast commented 1 year ago

Ah I see there is an issue with my solution. Will revisit the pull request at a later time!