コード例 #1
0
        public string WriteTypeScript(CodeConversionOptions options)
        {
            var context = new Context();

            return // imports
                   ((Imports.Select(i =>
                   // type
                                    "import { " + i.TransformIf(options.RemoveInterfacePrefix, StringUtilities.RemoveInterfacePrefix) + " }"
                   // module
                                    + " from " + ("./" + ModuleNameTransformation.Transform(i, options)).InQuotes(options.QuotationMark) + ";")
                     .Distinct().LineByLine()
                     + EmptyLine).If(Imports.Any() && options.ImportGenerationMode != ImportGenerationMode.None)
                    // types
                    + RootNodes.WriteTypeScript(options, context).ToEmptyLineSeparatedList()
                    // empty line at the end
                    + NewLine.If(options.AppendNewLine));
        }