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.
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.
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.
This PR will fix https://github.com/ca98am79/connect-dynamodb/issues/81.
I have made the following two modifications.
1、Remove
declare module "connect-dynamodb"
to eliminateexports and export assignments are not permitted
error. 2、Changeexport 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 https://github.com/microsoft/TypeScript/issues/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.