borisyankov/DefinitelyTyped — pull request #3077 by chbrown (2014-11-03 04:33:32+00:00)
Title: Declare jszip as a module, in addition to the JSZip global

I had a require.js (`--module amd`) powered project, and was having trouble getting require.js to play nicely with JSZip as required by a TypeScript file. When JSZip sees that AMD's define global is present, it doesn't export as the global `JSZip`, but the `jszip.d.ts` previously only supported global-style consumption. After some head-banging fun with TypeScript's undocumented `/// ` feature, and tricksy `jszip.d.ts` shims, I realized the reason why TypeScript didn't want to compile my `import-require` (with a one-two punch of TS2306 + TS2307) was because there was no `declare module ...` bit in jszip.d.ts.

I feel that not declaring the global would be the more proper solution, but to retain the widest compatibility possible, I only added the `declare module "jszip {...}` bit.

**References below:**

How jszip autodetects the AMD/commonjs/`