TodoMVC as Typescript - Backbone - requirejs project

Topics: General
Mar 15, 2014 at 9:33 PM
Does anyone have an example of a typescript project (preferable 1.0RC) with the TodoMVC refactored using requirejs. I'm been working on this now and am getting stuck on the requirejs portion. I'm consistently am getting the infamous "Mismatched anonymous define() module" error from requirejs.

I'll admit that I'm not familiar setting up the config and what-not of requirejs so I need some assistance in order to get a working version. The the supporting classes (Todo, TodoList, and TodoView) are separated into distinct class files. The goal is to be able to work with distinct class files. I'm surprised that there are hardly any good or working examples of this which I would think would be commonplace.

I'm pretty much blocked and extremely frustrated by this one issue so I appreciate any help in advanced.

Here's a link to the zipped project ... TodoMVC
Mar 20, 2014 at 2:35 AM
Well I couldn't wait and did the refactoring myself. I'll post a link to the project -- TodoMVC

I refactored the badly obsolete TodoMVC TypeScript example into a Visual Studio 2013 AMD project using RequireJS and refactored App.ts moving Todo, TodoList and TodoView into separate files and folders. I added the main.ts which instantiate the App class kicking off the application via its run method.

The obsolete version defines some nasty global variables such as a global TodoList. This causes grief for RequireJS because globals get resolved before the class are loaded. I moved the global TodoList into the App class. Trying to figure out RequireJS wasn't easy but perseverance paid off and I'm posting this refactored version of TodoMVC so others won't have to go through this experience and it now provides an excellent example of how to organize a real solution and project using TypeScript.