Skip to content

namespaceImplicitAmbientImports

Reports declared namespaces that implicitly export all members.

✅ This rule is included in the ts stylisticStrict presets.

When a declared namespace has no named export statements, all its members are implicitly exported. This can lead to unintended exports and make it harder to understand what the namespace exposes.

Adding an export {}; statement at the top of the namespace disables this implicit export behavior and allows you to explicitly control which members are exported.

declare namespace Values {
type Value = 1;
}
declare namespace Api {
interface Request {}
interface Response {}
}

If your project intentionally relies on the implicit export behavior of declared namespaces for brevity, you may not want to enable this rule. Some codebases with extensive legacy type declarations may find it impractical to add explicit exports to every namespace.

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.