TypeScripter icon indicating copy to clipboard operation
TypeScripter copied to clipboard

Add ability to make all properties camel case

Open brooklynDev opened this issue 8 years ago • 1 comments

In C# the convention is to use UpperCamelCase for property names. In JavaScript/Typescript however, the convention is to use lowerCamelCase. Currently, TypeScripter outputs property names exactly as is, which causes some friction on the front end in Typescript. This PR adds the ability to opt in to using lowerCamelCase for property names.

Note: I tried following the coding style as best I could.

brooklynDev avatar Apr 05 '17 05:04 brooklynDev

After digging through the source code some more, I realize that this is possible to do with formatters:

    public class LowerCamelCaseFormatter : TsFormatter
    {
        public override string Format(TsProperty property)
        {
            var result = base.Format(property);
            return char.ToLower(result[0]) + (result.Length == 1 ? String.Empty : result.Substring(1));
        }
    }

I'll leave this open for now, but feel free to close if you feel that a custom formatter is the preferred approach

brooklynDev avatar Apr 05 '17 06:04 brooklynDev