Experiments with TypeScript, MVVM and Windows Store apps – TypedMVVM available on CodePlex

Have you already tried TypeScript?

TypeScript is an Open-Source language designed by Anders Hejlsberg (the creator of C#, Delphi and Turbo Pascal) for extending JavaScript with additional features available in languages like C#: classes, static typing, interfaces, generics, and modularization (just to name a few).

The language is a typed superset of JavaScript: the compiler generates plain JavaScript that can be executed on every platform where JavaScript is supported (as reported on the main site: “Any Platform, Any host, Any OS”). The following links are a great starting point for understanding and learning it:

There’s been a lot of buzz about it in the last period and, while playing with this new language, I have created a new project on CodePlex – TypedMVVM – for experimenting how TypeScript could be used in a real world scenario by applying separation of concerns via the MVVM pattern in a simple Windows Store navigation app developed with WinJS.

Starting from the default Visual Studio Windows Store app Navigation template for JavaScript, I have converted all the .js source files to TypeScript (mainly renaming their extension to .ts) and then changed / added the following folder structure and classes / interfaces implementations:

  • designData – services implementation for design-time data in order to enable “Blendability”;
  • interfaces – interfaces for Services, ViewModels and ViewModelFactory;
  • libs – TypeScript definitions and TypedMVVM core classes (in particular RelayCommand<T> and ViewModelBase);
  • services – concrete services implementations used by the ViewModels;
  • viewModels - concrete ViewModels implementations;
  • views – views definitions.

The first impression is very positive: static typing is a must-have for writing complex apps and enabling features like refactoring or intellisense. Language features like interfaces, classes, generics and lambda expressions permit the developer to write code more readable, maintainable and extensible.

I’m planning to add more features and helper classes to this sample in the future whilst waiting for the final release of TypeScript so stay tuned!

The complete source code is available for download here: http://typedmvvm.codeplex.com

Happy Coding!

2 thoughts on “Experiments with TypeScript, MVVM and Windows Store apps – TypedMVVM available on CodePlex

  1. Pingback: Experiments with TypeScript, MVVM and Windows Store apps – TypedMVVM available on CodePlex

  2. Pingback: Experiments with TypeScript, MVVM and Windows Store apps – TypedMVVM available on CodePlex | TechBlog

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>