After reading this manual and this quote:
It’s important to note that in TypeScript 1.5, the nomenclature has changed. “Internal modules” are now “namespaces”. “External modules” are now simply “modules”
I was under impression that declare module
is no longer used and is replaced by declare namespace
, however when exploring node_modules\@types\node\index.d.ts
I can see that both declare module
and declare namespace
is used:
declare namespace NodeJS {
export var Console: {
prototype: Console;
new(stdout: WritableStream, stderr?: WritableStream): Console;
}
...
declare module "buffer" {
export var INSPECT_MAX_BYTES: number;
var BuffType: typeof Buffer;
var SlowBuffType: typeof SlowBuffer;
export { BuffType as Buffer, SlowBuffType as SlowBuffer };
}
Why so? What's the difference?
External modules (ES6 modules) do not come into play here as I understand.