Recently, I transformed my canvas library from plain JavaScript to TypeScript. I have structured the code using classes, all of which are part of the cnvs
module. However, I am facing difficulties in compiling these classes into a single file.
My goal is to eventually run my files through browserify, but for now, I just want to ensure everything is functioning correctly.
For example, one file may contain:
module cnvs {
export class Shape {
// code goes here
}
}
While another file could look like this:
/// <reference path="Shape.ts" />
module cnvs {
export class Rect extends Shape {
// rectangle specific code here
}
}
Initially, I was utilizing
import Shape = require('./Shape')
in various forms, including different extensions and paths without the leading './' as well.
In my cnvs.ts file, I intend to export the cnvs module so that, upon compilation, I will have a single file containing the entire code base that can either be attached to the window or broken into multiple files and then compiled into a single file using browserify.
You can find the complete code on http://github.com/allouis/cnvs
Thank you!