Declaration source files are restricted to contain declarations only. Declaration source files can be used to declare the static type information associated with existing JavaScript and expose their behavior.
I have started to implement TypeScript in my projects at work :-)
In that case I had to implement google analytics but ran into the problem, that I did not have intellisence for the that.
I googled a bit and could not find any declaration file for that, so I made my own.
I can now acces ga, _gaq, _gat and the Tracker object with intellicense in my TypeScript file, nice...
Example
describe("tester Google Analytics Code _gaq object", () => {
it("can create _push", () => {
_gaq.push(['_setAccount', 'UA-XXXXXXX-YY']);
_gaq.push(['_gat._anonymizeIp']);
_gaq.push(['_trackPageview']);
_gaq.push(() => {
var tracker = _gat._getTrackerByName('UA-65432-1');
tracker._trackPageview();
}
);
});
});
I have pushed it to https://github.com/borisyankov/DefinitelyTyped but until it is merged you can get the files here https://github.com/RonnieHegelund/DefinitelyTyped/tree/master/google.analytics