diff --git a/T4TS.Tests/Output/ModuleOutputAppenderTests.cs b/T4TS.Tests/Output/ModuleOutputAppenderTests.cs index 196a670..4ed73c2 100644 --- a/T4TS.Tests/Output/ModuleOutputAppenderTests.cs +++ b/T4TS.Tests/Output/ModuleOutputAppenderTests.cs @@ -45,6 +45,24 @@ public void TypescriptVersion090YieldsDeclareModule() appender.AppendOutput(module); Assert.IsTrue(sb.ToString().StartsWith("declare module ")); } + + [TestMethod] + public void TypescriptVersion150YieldsDeclareNamespace() + { + var sb = new StringBuilder(); + var module = new TypeScriptModule + { + QualifiedName = "Foo" + }; + + var appender = new ModuleOutputAppender(sb, 0, new Settings + { + CompatibilityVersion = new Version(1, 5, 0) + }); + + appender.AppendOutput(module); + Assert.IsTrue(sb.ToString().StartsWith("declare namespace ")); + } [TestMethod] public void DefaultTypescriptVersionYieldsDeclareModule() diff --git a/T4TS/Outputs/ModuleOutputAppender.cs b/T4TS/Outputs/ModuleOutputAppender.cs index e2e3c78..6254019 100644 --- a/T4TS/Outputs/ModuleOutputAppender.cs +++ b/T4TS/Outputs/ModuleOutputAppender.cs @@ -34,8 +34,10 @@ private void BeginModule(TypeScriptModule module) { if (Settings.CompatibilityVersion != null && Settings.CompatibilityVersion < new Version(0, 9, 0)) Output.Append("module "); - else + else if (Settings.CompatibilityVersion == null || Settings.CompatibilityVersion < new Version(1, 5, 0)) Output.Append("declare module "); + else + Output.Append("declare namespace "); Output.Append(module.QualifiedName); Output.AppendLine(" {");