Skip to content

namespaceKeywords

Reports using module keyword instead of namespace for TypeScript namespaces.

✅ This rule is included in the ts stylistic presets.

TypeScript originally used the module keyword to declare internal modules (namespaces). The namespace keyword was later introduced to avoid confusion with ES6 modules. Using namespace makes it clear you are defining a TypeScript namespace, not an ES6 module.

module Values {
export const value = 123;
}
declare module Utils {
export function format(input: string): string;
}

If you are working in a codebase that consistently uses module, and migrating to namespace is blocked on tooling issues or finding the time to do it, you may not want this rule.

You might consider using Flint disable comments and/or configuration file disables for those specific situations instead of completely disabling this rule.

Made with ❤️‍🔥 in Boston by Josh Goldberg and contributors.