问题
Good Day,
I have code something like below
In A.ts file:
declare class LayerManager {
//code
constructor(factory: Factory);
//code
}
let self: LayerManager;
function LayerManager(factory: Factory) {
//code
self = this;
//code
}
export default LayerManager;
In B.ts file:
import LayerManager from '../layer-manager/index';
//Code
this.layer = new LayerManager(this.factory); //<---In order to have construct Signature
I am using an approach Accepted on SO Link
The problem is i am getting an error of Module build fail(babel) continuously. Attaching Screenshot:
webpack:
{
// Include ts, tsx, js, and jsx files.
test: /\.(ts|js)x?$/,
exclude: /node_modules/,
loader: require.resolve('babel-loader'),
query: { compact: true }
},
Any suggestion would be helpful.
MINIMAL Reproduction added on GITHUB
来源:https://stackoverflow.com/questions/64323473/typeerror-duplicate-declaration-module-build-failed-error-in-typescript-projec