Skip to content

Conversation

@brooklynDev
Copy link

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 brooklynDev force-pushed the lower-camel-case-properties branch from 69e5c04 to 909f4c3 Compare April 5, 2017 05:53
@brooklynDev
Copy link
Author

brooklynDev commented Apr 5, 2017

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant