Please visit my re-post of this article.I had the privilege of spending time with four interns at Omnitech this summer. See our @Omnitech Twitter feed to learn a little more about them. Sometimes it's difficult to know how to have interns at a company, but we see it as an investment in them, the community and ourselves. We've had several interns in the past become valuable employees. It's fun to see how much they grow personally and technically in just a few months or years. I didn't have the opportunity ......
Typescript 1.5 allows you to import modules using the import statement. import {DataService} from"../Modules/jQueryAjaxD... In Visual Studio 2015, the Build: Cannot compile modules unless the '--module' flag is provided stops me from proceeding. Here are the steps to take to user AMD module loading in VS 2015. Edit the TypeScript Build Module System options in the properties of the web project. Make sure to change it for debug and release. I found this answer on StackOverflow. Edit the project ......
TypeScript and RequireJs work well together. Writing small modular code with Single Responsibilities (SOLID principles) is a good practice in any language and JavaScript is not an exception. AMD-Dependency Path Use amd-dependency path to include files you don’t need to use in code, but need to be loaded in order to run /// <amd-dependency path=”knockout-es5” /> Import Use import (translates to define([‘jquery’]) for adding in dependencies. Casing matters and must match the casing of the file ......
I found this out the hard way the other day. We’re using TypeScript and RequireJS for development. There’s a nice way to ensure the file has a dependency, without having to import it. Put the comment at the top of you file. /// <amd-dependency path="knockout-es5"/> I found that this needs to be at the very top or Require won’t pull in the file. I unsuspectingly added “use strict”; and it stopped working. After awhile, we moved it below and it worked. Invalid: “use strict”; /// <amd-dependency ......
I have a TypeScript class with PascalCasing, but the file name was camelCasing.ts (to match our other existing js files) and my TypeScript wouldn’t complied in our Gated Check-in build. It turns out that this is converted to a RequireJs define call, which looks at the filename, not the class name. That took awhile and help from team members to figure out. I hope you can avoid losing time like I did. Here’s a quick example: // my Typescript model, file name is webCam.ts class WebCam { id: string; ......
I had a module dependency, that I’m pulling down with RequireJS that I needed to use and write tests against. In this case, I don’t care about the actual implementation of the module (it’s simple enough that I’m just avoiding some AJAX calls). EDIT: make sure you look at the bottom example after the edit before using the config.map approach. I found that there is an easier way. I did not want to change the constructor of the consumer as I had a chain of changes that would have to be made and that ......