Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve Support for TypeScript NodeNext/Node16 Module Resolution #742

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

benasher44
Copy link
Contributor

If you update your TypeScript settings to use the new NodeNext moduleResolution setting, you can't use the Docxtemplater class without add an extra .default access:

import Docxtemplater from "docxtemplater";

const d = new Docxtemplater.default();

This problem is explained more generally here.

In Docxtemplater's case, this would likely crash at runtime, since there is no explicit .default property on the export.

This PR uses the recommended guidance to make the types compatible with NodeNext (confirmed still compatible with the previous non-NodeNext/Node16 resolution). It also adds an explicit .default attribute on the export for improved compatibility with those not using the TypeScript esModuleInterop: true setting.

@edi9999 edi9999 merged commit 8ed604c into open-xml-templating:master Jan 8, 2024
@edi9999
Copy link
Member

edi9999 commented Jan 8, 2024

Thank you !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants