I am currently using fabricjs in a project that I am transitioning to TypeScript, but I am having trouble understanding how to integrate it. In the past, I would create custom objects like this:
my.namespace.Control = fabric.util.createClass(fabric.Object, {
id: "",
type: 'Control',
color: "#000000",
...
});
For my new project, I have downloaded the TypeDefinition file from this source, but I am unsure of how to proceed.
Upon inspecting the .d.ts file, it seems that fabric.Object is not recognized as a Function, meaning it cannot be passed to createClass. Additionally, createClass itself returns void, preventing me from assigning its value to a variable.
Assuming all these issues were resolved, how should I structure this to adhere to TypeScript conventions? More specifically, how do I export it for use elsewhere when the Control class is required?
Has anyone successfully implemented this and can provide examples?