You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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,
}
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
}
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';
}
The text was updated successfully, but these errors were encountered: