Skip to content

typescript/no-namespace Restriction

What it does

Disallow TypeScript namespaces.

Why is this bad?

TypeScript historically allowed a form of code organization called "custom modules" (module Example {}), later renamed to "namespaces" (namespace Example). Namespaces are an outdated way to organize TypeScript code. ES2015 module syntax is now preferred (import/export).

Example

typescript
module foo {}
namespace foo {}
declare module foo {}
declare namespace foo {}

References

Released under the MIT License.