Issue with TypeScript Namespaces in PIXI.js
As I delve into the world of TypeScript and PIXI.js without any framework, I find myself facing a challenge. Previously, at work, we utilized namespaces with the module keyword for a cleaner structure. However, when attempting to replicate this setup in my current project, I encountered an error upon running the code in the browser.
The Challenge
The error message that surfaces in the console reads: "Uncaught TypeError: MyApp.AbstractModel is not a constructor" while pointing to a specific line in Main.ts file.
Troubleshooting & Solutions Attempted
Despite referencing the TypeScript documentation on Namespaces multiple times, I struggle to identify the root cause of the issue. Initially, I suspected webpack to not load all files properly, but after implementing suggestions from a Stack Overflow thread, including using 'require.context()', the error persists. Additionally, I experimented with importing the namespace directly in the main file, but to no avail.
Folder Structure
To provide some context, here is a glimpse of my project's directory structure:
stack-overflow-example
| - .idea
| - dev
| | - dts
| | | <all .d.ts files from tsc compilation>
| | - js
| | | <all .js files and accompanying .js.map files from compiled .ts files>
| | - index.html
| - node_modules
| - src
| | - graphics
| | | - pixi-manager.ts
| | - model
| | | - AbstractModel.ts
| | - Main.ts
| | - refs.ts
| package.json
| package-lock.json
| tsconfig.json
| webpack.config.js
Looking for Solutions
If anyone has insights on resolving the "MyApp.AbstractModel is not a constructor" error without migrating to modules, your assistance would be invaluable. Thank you for taking the time to help out.