diff --git a/src/app/cs2ts/cs2ts.component.html b/src/app/cs2ts/cs2ts.component.html index 34325b1..dfd8805 100644 --- a/src/app/cs2ts/cs2ts.component.html +++ b/src/app/cs2ts/cs2ts.component.html @@ -27,4 +27,69 @@

C# to TS Converter

+ +
+ +
+
+

Supports:

+ +
+
\ No newline at end of file diff --git a/src/app/cs2ts/cs2ts.component.ts b/src/app/cs2ts/cs2ts.component.ts index 6c571a8..88e378f 100644 --- a/src/app/cs2ts/cs2ts.component.ts +++ b/src/app/cs2ts/cs2ts.component.ts @@ -41,11 +41,11 @@ export class Cs2tsComponent implements AfterContentInit { protected status: boolean = false; protected inputDebouncer = new Subject(); - - constructor(meta:Meta){ + + constructor(meta: Meta) { meta.addTags([ - {name: "description", content:"Converts C# model to TS model, converts fields, types, arrays and generics."}, - {name: "keywords", content:"C#, TS, CSharp, TypeScript, script, type, generic, array, converter, model, fields, string, number, int, class, code, language, long, float, boolean, bool"}, + { name: "description", content: "Converts C# model to TS model, converts fields, types, arrays and generics." }, + { name: "keywords", content: "C#, TS, CSharp, TypeScript, script, type, generic, array, converter, model, DTO, DataTransferObject, POCO, fields, string, number, int, class, code, language, long, float, boolean, bool" }, ]); this.placeholder2 = Cs2tsComponent.convert(this.placeholder1); @@ -102,19 +102,40 @@ export class Cs2tsComponent implements AfterContentInit { return code; } - private static convertTypes(a: string | undefined): string | undefined { - if (a === "bool") - return "boolean"; - - switch (a) { + private static convertTypes(t: string | undefined): string | undefined { + if (!t) + return t; + + switch (t!.toLowerCase()) { + case "bool": + return "boolean"; + case "byte": + case "sbyte": + case "short": + case "ushort": case "int": + case "uint": case "float": case "double": case "decimal": - case "long": return "number"; + case "long": + case "ulong": + return "bigint"; + case "char": + case "string": + return "string"; + case "datetime": + case "dateonly": + case "timeonly": + return "Date"; + case "object": + case "dynamic": + return "any"; + case "void": + return "void"; + default: + return t; } - - return a; } }