Reputation: 1402
In typescript, what is the difference between these two:
declare module foo { ... }
and
declare namespace foo { ... }
From the docs I get the feeling they should be the same and the second one is preferred. However I see many .d.ts files that uses the first one which makes me unsure.
Upvotes: 4
Views: 399
Reputation: 276383
They are exactly the same. The keyword module
was deprecated in favor of namespace
in this case.
This is because module
confuses the with the concept of file modules : https://basarat.gitbooks.io/typescript/content/docs/project/modules.html
Upvotes: 4