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

Fix for users using NodeNext TS Module #50

Conversation

simonmcallister0210
Copy link
Owner

Context

Users using the NodeNext in their tsconfig.json file noticed issues importing from the package. Errors like:

Module 'cognito-srp-helper' has no exported member 'createSrpSession'

Looking inside the dist/types folder they noticed this type error:

Relative import paths need explicit file extensions in ECMAScript imports when '--moduleResolution' is 'node16' or 'nodenext'. Consider adding an extension to the import path.

1 export * from "./cognito-srp-helper";

Using a single declaration file would fix this, because it removes the need for any import statements. For this fix we're tweaking the type build to output a single file index.d.ts

Changes

Tweak build:types script to output single declaration file index.d.ts

Testing

Before:
Screenshot 2024-12-01 at 20 39 49

After:
Screenshot 2024-12-01 at 20 42 26

@simonmcallister0210 simonmcallister0210 linked an issue Dec 1, 2024 that may be closed by this pull request
@simonmcallister0210 simonmcallister0210 merged commit 5f09a7c into main Dec 17, 2024
2 checks passed
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.

Import errors with --moduleResolution 'node16' or 'nodenext'
1 participant