-
Notifications
You must be signed in to change notification settings - Fork 60
Description
I created a class in C# that uses an enum in it. I want to convert the enum values to strings in my typescript class. I am also using a default value. In the genreated typescript enum the values are converted to strings, but in my ts class the value is still a number. the typescript code won't compile unless the enum default value is a string on the class that uses it as well.
My C# class:
public class OrganizationUser
{
// other properties
public UserOrganizationRole Relation { get; set; } = UserOrganizationRole.Viewer;
}
C# enum:
[TsStringInitializers]
public enum UserOrganizationRole
{
// other values
Viewer,
}
tgconfig.json:
{
"singleQuotes": true,
"csNullableTranslation": "null|undefined",
"outputPath": "../frontend",
"camelCase": true,
"enumStringInitializers": true
}
user-organization-role.ts
export enum UserOrganizationRole {
// other values
Viewer = 'Viewer',
}
organization-user.ts
export class OrganizationUser {
// other properties
relation: string = 'Viewer';
}