self.ts_lookup

in lib/generators/react/component_generator.rb [215:237]


      def self.ts_lookup(name, type = 'node', args = '')
        ts_type = TYPESCRIPT_TYPES[type]
        if ts_type.blank?
          if type =~ /^[[:upper:]]/
            ts_type = TYPESCRIPT_TYPES['instanceOf']
          else
            ts_type = TYPESCRIPT_TYPES['node']
          end
        end

        args = args.to_s.gsub(/[{}]/, '').split(',')

        if ts_type.respond_to? :call
          if args.blank?
            return ts_type.call(type)
          end

          ts_type = ts_type.call(*args)
        end

        ts_type
      end