File tree Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Expand file tree Collapse file tree 1 file changed +17
-5
lines changed Original file line number Diff line number Diff line change @@ -61,11 +61,23 @@ export abstract class ImportBaseCommand<T extends typeof Command> extends Comman
61
61
this . args = args as Args < T > ;
62
62
this . conf = getConfiguration ( ) ;
63
63
64
- if (
65
- ! this . conf . wantNeedTracking &&
66
- isObjectWithKeys ( this . conf . expenseTypeMapping )
67
- ) {
68
- throw new Error ( "Found expenseTypeMapping when wantNeedTracking is off." ) ;
64
+ // TODO: This should be in ../utils/config.js but errors aren't thrown properly
65
+ if ( ! this . conf . wantNeedTracking ) {
66
+ if ( isObjectWithKeys ( this . conf . expenseTypeMapping ) ) {
67
+ throw new Error ( "Found expenseTypeMapping when wantNeedTracking is off." ) ;
68
+ }
69
+
70
+ const hasExpenseType = ( this . conf . autoCategorization || [ ] )
71
+ . map ( ( el , index ) => {
72
+ return el . categorization . expenseType ? index : null ;
73
+ } )
74
+ . filter ( ( el ) => typeof el === "number" ) ;
75
+
76
+ if ( hasExpenseType . length ) {
77
+ throw new Error (
78
+ "Found expenseTypein autoCategorization when wantNeedTracking is off."
79
+ ) ;
80
+ }
69
81
}
70
82
}
71
83
You can’t perform that action at this time.
0 commit comments