@@ -105,6 +105,7 @@ def non_colliding_inputs(type_declaration = inputs_type, result = [], path = [])
105105 non_colliding_inputs ( type_declaration . to_type . attributes_type , result , path )
106106 elsif type_declaration . array?
107107 if type_declaration . element_type
108+ # TODO: isn't this a no-op??
108109 type_generators ( type_declaration . element_type , false )
109110 end
110111 else
@@ -166,6 +167,25 @@ def initialize(generator, path, type_declaration)
166167 self . type_declaration = type_declaration
167168 end
168169
170+ def custom?
171+ type_declaration . custom?
172+ end
173+
174+ def one_of
175+ real_type_declaration . one_of
176+ end
177+
178+ # TODO: something feels kind of wrong here, hmmm
179+ def real_type_declaration
180+ @real_type_declaration ||= if custom?
181+ # We are dealing with a reference to a registered type
182+ # so we need the declaration this type name was registered to
183+ type_declaration . to_type . to_type_declaration_from_declaration_data
184+ else
185+ type_declaration
186+ end
187+ end
188+
169189 def name
170190 first , *rest = path
171191
@@ -187,11 +207,11 @@ def ts_type
187207 end
188208
189209 def has_default?
190- type_declaration . attribute? && default
210+ real_type_declaration . attribute? && default
191211 end
192212
193213 def default
194- type_declaration . default
214+ real_type_declaration . default
195215 end
196216
197217 def ts_default
@@ -204,8 +224,6 @@ def name_english
204224
205225 def html_input
206226 # TODO: handle boolean, etc
207- one_of = type_declaration . one_of
208-
209227 if one_of
210228 ts_type = generator . foobara_type_to_ts_type ( type_declaration )
211229
0 commit comments