Although JavaScript and its many libraries (jQuery, RequireJS) allow for the creation of many great websites I find its lack of type safety daunting when contemplating building a larger website.
Google has a wonderful closure compiler which allows you to annotate your JavaScript with JSDoc and have it type check. Having experimented with its rich type system I expect this would greatly improve the maintainability of a longer lived JavaScript project.
The only problem is it doesn't play very nicely with AMD libraries like RequireJS. There is an experimental --transform_amd_modules flag that concatenates your JavaScript files and handles scoping by eliminating it. However this seems to be a bit of an anti-pattern, removing most of the benefits of RequireJS (but keeping the modular file structure). There's also the question of how much future support that will get
With the end goal being type-safety not at the expensive of RequireJS's benefits what would be my best bets?
PS: Although I've used RequireJS as the AMD library of choice I would not be against a solution that worked with a different AMD library.