fix: exports and export assignments are not permitted
and not use export default
#84
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR will fix #81.
I have made the following two modifications.
1、Remove
declare module "connect-dynamodb"
to eliminateexports and export assignments are not permitted
error.2、Change
export default
toexport =
to avoid the errorThis 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.
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.