Skip to content

Conversation

@leonsilicon
Copy link
Contributor

@leonsilicon leonsilicon commented Nov 16, 2022

Currently, when using js-base64 with ESM and Node16 "moduleResolution" in TypeScript, TypeScript is unable to resolve the types because it resolves base64.mjs in ESM mode and checks for a definition file named base64.d.mts, which doesn't exist.

I fixed this by adding an explicit "types" property that points to base64.d.ts inside the "exports" property, based on the screenshot of the docs below (screenshot from https://www.typescriptlang.org/docs/handbook/esm-node.html):
image

@dankogai dankogai merged commit 2410b88 into dankogai:main Nov 16, 2022
@dankogai
Copy link
Owner

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