ical-generator: "This expression is not callable" with module: "node16" in tsconfig.json
Hi @sebbo2002 👋 Thanks again for ical-generator, very useful!
The new module resolution option node16 does not work with ical-generator unfortunately, failing with the This expression is not callable error:
This expression is not callable.
Type 'typeof import("stackblitz:/node_modules/ical-generator/dist/index")' has no call signatures.
StackBlitz demo: https://stackblitz.com/edit/node-mmyw9w?file=tsconfig.json,package.json&file=tsconfig.json,index.ts
The problem is the export default in the published index.d.ts, as far as I understand, since ical-generator uses a CommonJS module.exports = export, this should actually instead be export =.
You can also see this on the tool Are The Types Wrong from @andrewbranch:
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 1
- Comments: 15 (15 by maintainers)
Commits related to this issue
- Upgrade ical-generator, remove obsolete patch Ref: https://github.com/sebbo2002/ical-generator/issues/469#issuecomment-1474459625 — committed to upleveled/ical-move-events by karlhorky a year ago
Yeah, any issue in Are The Types Wrong? is an issue, any “Masquerading as …” error is going to cause the same type of errors when
importing /requireing that I reported.Thanks for the tip with
cp! If I see anything else better (or find a way to do it intsc), I’ll try to report back here! Would love to be able to make this as zero-config and easy for lib authors / maintainers as possible!Great, thanks so much for this! 🙌
I can confirm that it’s working - just upgraded to
ical-generator@4.0.0in our projectical-move-eventsand it works 🎉I would have a question: how did you get the compiler to emit the
dist/index.d.ctsfile?Was it just this change to the
tsconfig.jsonin https://github.com/sebbo2002/ical-generator/pull/462?I’d like to learn how you did it to be able to recommend things for other packages too…
If you have any other changes that should be highlighted, happy to hear about those too!
Fixed with 🎉 4.0.0
That’s what I meant with duplicating the file. Okay. I will play around a bit more on the weekend, feel free to use the
develop.1for this time. I’ll update the ticket here when I think I’m done with customizations 😅