【发布时间】:2018-11-06 09:05:14
【问题描述】:
目前我正在使用 Typewriter 从我的 C# 类中自动生成 TypeScript 类:
[TsDTO]
public class MyDto {
public string Prop1 { get; set; }
public string Prop2 { get; set; }
}
我想简单地生成一个 Typescript 接口,将后缀“xyz”附加到属性名称:
export Interface IMyDto {
prop1xyz: string;
prop2xyz: string;
}
是否可以在不创建自定义方法的情况下定义我的模板以添加“xyz”?
此模板不起作用:
$Classes(c => HasAttribute(c.Attributes, "TsDTO"))[
export interface I$Name {
// properties
$Properties()[$namexyz: $Type; <-- "xyz" breaks the code!
]
}]
【问题讨论】:
标签: typewriter