code refactor

This commit is contained in:
MaysWind
2025-01-12 13:15:10 +08:00
parent f2ebd751d4
commit 6a62cfdef7
9 changed files with 39 additions and 39 deletions
+1 -1
View File
@@ -70,7 +70,7 @@ export class AccountCategory implements TypeAndName {
return AccountCategory.allInstances;
}
public static valueOf(type: number): AccountCategory {
public static valueOf(type: number): AccountCategory | undefined {
return AccountCategory.allInstancesByType[type];
}
}
+1 -1
View File
@@ -47,7 +47,7 @@ export class PresetAmountColor implements TypeAndName {
return PresetAmountColor.allInstances;
}
public static valueOf(type: number): PresetAmountColor {
public static valueOf(type: number): PresetAmountColor | undefined {
return PresetAmountColor.allInstancesByType[type];
}
}
+2 -2
View File
@@ -64,11 +64,11 @@ export class CurrencyDisplayType implements TypeAndName {
return CurrencyDisplayType.allInstances;
}
public static valueOf(type: number): CurrencyDisplayType {
public static valueOf(type: number): CurrencyDisplayType | undefined {
return CurrencyDisplayType.allInstancesByType[type];
}
public static parse(typeName: string): CurrencyDisplayType {
public static parse(typeName: string): CurrencyDisplayType | undefined {
return CurrencyDisplayType.allInstancesByTypeName[typeName];
}
}
+8 -8
View File
@@ -160,7 +160,7 @@ export class Month {
return Month.allInstances;
}
public static valueOf(month: number): Month {
public static valueOf(month: number): Month | undefined {
return Month.allInstances[month - 1];
}
}
@@ -194,11 +194,11 @@ export class WeekDay implements TypeAndName {
return WeekDay.allInstances;
}
public static valueOf(dayOfWeek: number): WeekDay {
public static valueOf(dayOfWeek: number): WeekDay | undefined {
return WeekDay.allInstances[dayOfWeek];
}
public static parse(typeName: string): WeekDay {
public static parse(typeName: string): WeekDay | undefined {
return WeekDay.allInstancesByName[typeName];
}
}
@@ -269,7 +269,7 @@ export class LongDateFormat implements DateFormat {
return LongDateFormat.allInstancesByTypeName;
}
public static valueOf(type: number): LongDateFormat {
public static valueOf(type: number): LongDateFormat | undefined {
return LongDateFormat.allInstancesByType[type];
}
}
@@ -309,7 +309,7 @@ export class ShortDateFormat implements DateFormat {
return ShortDateFormat.allInstancesByTypeName;
}
public static valueOf(type: number): ShortDateFormat {
public static valueOf(type: number): ShortDateFormat | undefined {
return ShortDateFormat.allInstancesByType[type];
}
}
@@ -360,7 +360,7 @@ export class LongTimeFormat implements TimeFormat {
return LongTimeFormat.allInstancesByTypeName;
}
public static valueOf(type: number): LongTimeFormat {
public static valueOf(type: number): LongTimeFormat | undefined {
return LongTimeFormat.allInstancesByType[type];
}
}
@@ -404,7 +404,7 @@ export class ShortTimeFormat implements TimeFormat {
return ShortTimeFormat.allInstancesByTypeName;
}
public static valueOf(type: number): ShortTimeFormat {
public static valueOf(type: number): ShortTimeFormat | undefined {
return ShortTimeFormat.allInstancesByType[type];
}
}
@@ -496,7 +496,7 @@ export class DateRange implements TypeAndName {
return DateRange.allInstancesByTypeName;
}
public static valueOf(type: number): DateRange {
public static valueOf(type: number): DateRange | undefined {
return DateRange.allInstancesByType[type];
}
+7 -7
View File
@@ -56,11 +56,11 @@ export class DecimalSeparator implements TypeAndName, NumeralSymbolType {
return DecimalSeparator.allInstances;
}
public static valueOf(type: number): DecimalSeparator {
public static valueOf(type: number): DecimalSeparator | undefined {
return DecimalSeparator.allInstancesByType[type];
}
public static parse(typeName: string): DecimalSeparator {
public static parse(typeName: string): DecimalSeparator | undefined {
return DecimalSeparator.allInstancesByTypeName[typeName];
}
}
@@ -96,11 +96,11 @@ export class DigitGroupingSymbol implements TypeAndName, NumeralSymbolType {
return DigitGroupingSymbol.allInstances;
}
public static valueOf(type: number): DigitGroupingSymbol {
public static valueOf(type: number): DigitGroupingSymbol | undefined {
return DigitGroupingSymbol.allInstancesByType[type];
}
public static parse(typeName: string): DigitGroupingSymbol {
public static parse(typeName: string): DigitGroupingSymbol | undefined {
return DigitGroupingSymbol.allInstancesByTypeName[typeName];
}
}
@@ -136,11 +136,11 @@ export class DigitGroupingType implements TypeAndName {
return DigitGroupingType.allInstances;
}
public static valueOf(type: number): DigitGroupingType {
public static valueOf(type: number): DigitGroupingType | undefined {
return DigitGroupingType.allInstancesByType[type];
}
public static parse(typeName: string): DigitGroupingType {
public static parse(typeName: string): DigitGroupingType | undefined {
return DigitGroupingType.allInstancesByTypeName[typeName];
}
}
@@ -173,7 +173,7 @@ export class AmountFilterType {
return AmountFilterType.allInstances;
}
public static valueOf(type: string): AmountFilterType {
public static valueOf(type: string): AmountFilterType | undefined {
return AmountFilterType.allInstancesByType[type];
}
}
+3 -3
View File
@@ -139,7 +139,7 @@ export class ChartDataType implements TypeAndName {
return ChartDataType.allInstancesByTypeName;
}
public static valueOf(type: number): ChartDataType {
public static valueOf(type: number): ChartDataType | undefined {
return ChartDataType.allInstancesByType[type];
}
@@ -176,7 +176,7 @@ export class ChartSortingType implements TypeAndName {
return ChartSortingType.allInstances;
}
public static valueOf(type: number): ChartSortingType {
public static valueOf(type: number): ChartSortingType | undefined {
return ChartSortingType.allInstancesByType[type];
}
}
@@ -206,7 +206,7 @@ export class ChartDateAggregationType implements TypeAndName {
return ChartDateAggregationType.allInstances;
}
public static valueOf(type: number): ChartDateAggregationType {
public static valueOf(type: number): ChartDateAggregationType | undefined {
return ChartDateAggregationType.allInstancesByType[type];
}
}
+2 -2
View File
@@ -30,7 +30,7 @@ export class TemplateType implements TypeAndName {
return TemplateType.allInstancesByTypeName;
}
public static valueOf(type: number): TemplateType {
public static valueOf(type: number): TemplateType | undefined {
return TemplateType.allInstancesByType[type];
}
}
@@ -66,7 +66,7 @@ export class ScheduledTemplateFrequencyType implements TypeAndName {
return ScheduledTemplateFrequencyType.allInstancesByTypeName;
}
public static valueOf(type: number): ScheduledTemplateFrequencyType {
public static valueOf(type: number): ScheduledTemplateFrequencyType | undefined {
return ScheduledTemplateFrequencyType.allInstancesByType[type];
}
}