System.Globalization Types generated without beeing used.
I use a Property of the following Type in my CSharp class: System.Globalization.CultureInfo
but in Code I use a Converter so it is treated as a string: .WithConvertor<System.Globalization.CultureInfo>(type => { return "string"; })
but then in my ts file I have the following classes: (without beeing used....)
eclare module System.Globalization { export class CompareInfo { Name: string; LCID: number; Version: System.Globalization.SortVersion; } export class SortVersion { FullVersion: number; SortId: string; } export class TextInfo { ANSICodePage: number; OEMCodePage: number; MacCodePage: number; EBCDICCodePage: number; LCID: number; CultureName: string; IsReadOnly: boolean; ListSeparator: string; IsRightToLeft: boolean; } export class NumberFormatInfo { InvariantInfo: System.Globalization.NumberFormatInfo; CurrencyDecimalDigits: number; CurrencyDecimalSeparator: string; IsReadOnly: boolean; CurrencyGroupSizes: number[]; NumberGroupSizes: number[]; PercentGroupSizes: number[]; CurrencyGroupSeparator: string; CurrencySymbol: string; CurrentInfo: System.Globalization.NumberFormatInfo; NaNSymbol: string; CurrencyNegativePattern: number; NumberNegativePattern: number; PercentPositivePattern: number; PercentNegativePattern: number; NegativeInfinitySymbol: string; NegativeSign: string; NumberDecimalDigits: number; NumberDecimalSeparator: string; NumberGroupSeparator: string; CurrencyPositivePattern: number; PositiveInfinitySymbol: string; PositiveSign: string; PercentDecimalDigits: number; PercentDecimalSeparator: string; PercentGroupSeparator: string; PercentSymbol: string; PerMilleSymbol: string; NativeDigits: string[]; DigitSubstitution: System.Globalization.DigitShapes; } export class DateTimeFormatInfo { InvariantInfo: System.Globalization.DateTimeFormatInfo; CurrentInfo: System.Globalization.DateTimeFormatInfo; AMDesignator: string; Calendar: System.Globalization.Calendar; DateSeparator: string; FirstDayOfWeek: System.DayOfWeek; CalendarWeekRule: System.Globalization.CalendarWeekRule; FullDateTimePattern: string; LongDatePattern: string; LongTimePattern: string; MonthDayPattern: string; PMDesignator: string; RFC1123Pattern: string; ShortDatePattern: string; ShortTimePattern: string; SortableDateTimePattern: string; TimeSeparator: string; UniversalSortableDateTimePattern: string; YearMonthPattern: string; AbbreviatedDayNames: string[]; ShortestDayNames: string[]; DayNames: string[]; AbbreviatedMonthNames: string[]; MonthNames: string[]; IsReadOnly: boolean; NativeCalendarName: string; AbbreviatedMonthGenitiveNames: string[]; MonthGenitiveNames: string[]; } export class Calendar { MinSupportedDateTime: Date; MaxSupportedDateTime: Date; AlgorithmType: System.Globalization.CalendarAlgorithmType; IsReadOnly: boolean; Eras: number[]; TwoDigitYearMax: number; } }
Comments (5)
-
-
I created a Unit Test for this:
using System.Globalization; using Xunit; namespace TypeLite.Tests.RegressionTests { public class Issue103_GlobalizationTypes { [Fact] public void GlobalizationTypesCreatedWhenNotUsed() { var ts = TypeScript.Definitions(); ts.For<TestClass>().WithConvertor<System.Globalization.CultureInfo>(type => { return "string"; }); var result = ts.Generate(TsGeneratorOutput.Properties); } class TestClass { public CultureInfo CultureInfo { get; set; } } } }
-
I see in the Code that the Converters are completely ignored when searching for referenced types...
-
I've created Pull Req
#29to fix it, but maybe there is a better way.I fixed it so, but it only works when the converters are specified before!
-
- changed status to resolved
Fixed in version 1.7.0
- Log in to comment
Sorry forgot to Log in!