'Why can I export with or without writing export in a `Ambient Namespaces`?

The document of ts ambient-namespaces

Why can I export with or without writing export in a Ambient Namespaces?

And what is the difference between Ambient Namespaces (with declare) and ordinary namespaces (without declare) in typescript?

declare namespace Test {
  export interface A {}
  interface B {}
  export type C = {}
  type D = {}
  export const a = 1
  const b = 2
}

type Test1 = Test.D // this is effective,but type D is not exported.


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source