-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
C# Collection type as any[] #131
Comments
Yes it is. If this is an external module, you need to generate a model type for the collection element and import it. helpers IEnumerable<Type> PropertyTypes(Class @class) =>
@class.Properties
.Select(x => x.Type)
.Select(x => x.Unwrap()) // the magic
.Where(x => !x.IsPrimitive || x.IsDate || x.IsEnum)
.GroupBy(x => x.Name).Select(x => x.First());
string PropertyTypeName(Property property) =>
property.Type.Name == "Date" ? "Moment | string" : property.Type.Name;
string ImportTypeName(Type type) => type.Name == "Date" ? "{ Moment }" : type.Name;
string FileName(Class @class) => "./" + FileNameFromTypeName(@class.name);
string FileName(Interface @interface) => "./" + FileNameFromTypeName(@interface.name);
string FileName(Property property) => "./" + FileNameFromTypeName(property.Type.name);
string FileName(Type type) => type.IsDate? "moment" : "./" + FileNameFromTypeName(type.name);
string FileName(string type) => "./" + FileNameFromTypeName(type); template $Classes[
$PropertyTypes[
import $ImportTypeName from '$FileName';
]
export interface $Name {
$Properties[$name?: $PropertyTypeName;
]
}
export default $Name;
] |
Resolved in 1.8.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I got an old project with lots of custom collections like:
result on rendering:
in tst file
Would like to have
Is it possible?
The text was updated successfully, but these errors were encountered: