File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -49,12 +49,7 @@ export const getTypeVariant = (
4949 ) {
5050 discoveredVariant = DataTypeVariant . PRIMITIVE ;
5151 } else if ( type . isClassOrInterface ( ) || ( type . getFlags ( ) & ts . TypeFlags . Object ) !== 0 ) {
52- // Check if it's literally just a type alias to something else or a complex object
53- if ( type . getProperties ( ) . length > 0 ) {
54- discoveredVariant = DataTypeVariant . OBJECT ;
55- } else {
56- discoveredVariant = DataTypeVariant . TYPE ;
57- }
52+ discoveredVariant = DataTypeVariant . OBJECT ;
5853 } else {
5954 discoveredVariant = DataTypeVariant . TYPE ;
6055 }
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ describe('getTypeVariant', () => {
1717
1818 it ( 'sollte OBJECT für Interfaces oder Objekte mit Properties zurückgeben' , ( ) => {
1919 expect ( getTypeVariant ( "{ name: string }" , DATA_TYPES ) ) . toBe ( DataTypeVariant . OBJECT ) ;
20+ expect ( getTypeVariant ( "{}" , DATA_TYPES ) ) . toBe ( DataTypeVariant . OBJECT ) ;
2021 } ) ;
2122
2223 it ( 'sollte TYPE für einfache Type-Aliase oder void zurückgeben' , ( ) => {
@@ -27,6 +28,7 @@ describe('getTypeVariant', () => {
2728 it ( 'sollte LIST (NUMBER) als ARRAY erkennen (wenn in DATA_TYPES definiert)' , ( ) => {
2829 // In data.ts ist LIST als T[] definiert
2930 expect ( getTypeVariant ( "LIST<NUMBER>" , DATA_TYPES ) ) . toBe ( DataTypeVariant . ARRAY ) ;
31+ expect ( getTypeVariant ( "LIST<unknown>" , DATA_TYPES ) ) . toBe ( DataTypeVariant . ARRAY ) ;
3032 } ) ;
3133
3234 it ( 'sollte NODE für Funktionstypen wie CONSUMER zurückgeben' , ( ) => {
@@ -44,6 +46,7 @@ describe('getTypeVariant', () => {
4446 expect ( getTypeVariant ( "PREDICATE<NUMBER>" , DATA_TYPES ) ) . toBe ( DataTypeVariant . NODE ) ;
4547 } ) ;
4648
49+
4750 it ( "Check if" , ( ) => {
4851 const types = getTypesFromNode ( {
4952 functionDefinition : {
You can’t perform that action at this time.
0 commit comments