fork from http://typescript.codeplex.com/