Skip to content

fix: exports and export assignments are not permitted and not use export default #84

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

Merged
merged 2 commits into from
Aug 24, 2023

Conversation

yutak23
Copy link
Contributor

@yutak23 yutak23 commented Aug 18, 2023

This PR will fix #81.

I have made the following two modifications.

1、Remove declare module "connect-dynamodb" to eliminate exports and export assignments are not permitted error.
2、Change export default to export = to avoid the error This expression is not callable when developing with ES Module.

About 1

Declaration declare module "connect-dynamodb" is, in other words, a declaration that the type definition of connect-dynamodb is being done, which will be merged with the contents of index.d.ts (Module Augmentation).

Thus, index.d.ts will be equivalent to the following state.

export = ConnectDynamoDB;.
export default ConnectDynamoDB;.

The above is NG because of the mixed module system, and I believe that this PR change will unify them into export = ConnectDynamoDB;, so the error will no longer occur.

About 2

ES Module seems incompatible in CommonJS project with default export (see microsoft/TypeScript#52086).
To keep TypeScript types compatible with both CommonJS and ES Module, based on Module: Function and Default Exports, it is easy to use export =.

Although the difference appears large, the only part that has been changed is that interfaces and types, which were individually exported, are now defined in the namespace and the namespace is also exported.

@yutak23
Copy link
Contributor Author

yutak23 commented Aug 23, 2023

@ca98am79

How about my suggestion here? I would appreciate your reply.

@ca98am79 ca98am79 merged commit d1914c3 into ca98am79:master Aug 24, 2023
@ca98am79
Copy link
Owner

thanks!

@yutak23 yutak23 deleted the fix-type branch August 24, 2023 22:56
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.

Error TS2666: Exports and export assignments are not permitted in module augmentations.
2 participants