Typescript interface, function and namespace all have the same name. Which is being exported?

In the Typescript definition file (DefinitelyTyped) I am examining, there is an interface, a function and a namespace all with the exact same name: twilio.

Here is the sample, from the first few lines of the file:

declare interface twilio {
  (sid?: string, tkn?: string, options?: twilio.ClientOptions): twilio.RestClient
}

declare function twilio(sid?: string, tkn?: string, options?: twilio.ClientOptions): twilio.RestClient;

declare namespace twilio {
 ....

Then all the way at the bottom of the file it says

export = twilio;

Well which one is it exporting? The interface? The function? the namespace? How does this make any sense? How can you name multiple things the exact same nae in the same scope/namespace ??


The official typescript doc calls this "declaration merging".