Skip to content

Commit be1c8e3

Browse files
author
roman_g
committed
Custom converters have priority over default rules
1 parent cb077c6 commit be1c8e3

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

src/LazyCoder/Typescript/TsType.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,14 @@ private static TsType From(Type type,
6262
new TsNull());
6363
}
6464

65+
foreach (var customTypeConverter in customTypeConverters)
66+
{
67+
if (customTypeConverter.TryConvert(type, out var tsType))
68+
{
69+
return tsType;
70+
}
71+
}
72+
6573
if (Helpers.IsEnumerable(type))
6674
{
6775
return new TsArrayType { ElementType = From(Helpers.UnwrapEnumerableType(type)) };
@@ -101,14 +109,6 @@ private static TsType From(Type type,
101109
};
102110
}
103111

104-
foreach (var customTypeConverter in customTypeConverters)
105-
{
106-
if (customTypeConverter.TryConvert(type, out var tsType))
107-
{
108-
return tsType;
109-
}
110-
}
111-
112112
return FromInternal(type);
113113
}
114114

0 commit comments

Comments
 (0)