Currently, I'm in the process of converting JavaScript code to TypeScript and encountering some challenges with converting class definitions.
These classes are based on Marionette and have namespaced class names. For instance, in JavaScript with the 'xyz' namespace:
xyz.Marionette.AppRouter = Marionette.AppRouter.extend({
instance_name: "AppRouter",
functionName: function(options) {
}
});
I attempted to convert this class definition to TypeScript as follows:
class xyz.Marionette.AppRouter extends Marionette.AppRouter {
However, it appears that this syntax is not supported in TypeScript.
Is there a way to declare a class in TypeScript with namespacing?
The responses provided below have been informative, but I still require clarity on how to articulate this definition, or if it's feasible at all.