tl;dr Learn about promises and deferreds
A good way to learn about this from the Typescript perspective might be looking at DefinitelyTyped to see how they're typing jQuery.
The definition(s) for getJSON can be found here, e.g.
getJSON(url: string, success?: (data: any, textStatus: string, jqXHR: JQueryXHR) => any): JQueryXHR;
As you can see, it returns a new type JQueryXHR which is an interface that can be found here:
interface JQueryXHR extends XMLHttpRequest, JQueryPromise<any> {
overrideMimeType(mimeType: string): any;
abort(statusText?: string): void;
}
This, in turn, references JQueryPromise, which can be found here and now contains all these callbacks:
interface JQueryPromise<T> {
always(alwaysCallbacks1?: JQueryPromiseCallback<T>, ...alwaysCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
done(doneCallbacks1?: JQueryPromiseCallback<T>, ...doneCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
fail(failCallbacks1?: JQueryPromiseCallback<T>, ...failCallbacks2: JQueryPromiseCallback<T>[]): JQueryDeferred<T>;
// … and so on …
}
That would be the Typescript part. If you're interested in the actual implementation, you could have a look at the jQuery source directly. The basic idea is that the method only returns a promise to which you can add your handlers. The deferred will then resolve and call the attached handlers.
A rather quick example would be the following; (I have removed the example because an example that misses the point is not really worth anything and might, if anything, give wrong ideas).