parameters: (self, namespace_name, js_type)
return_statement: return Code().Append('?')
docstring: Converts a model.Type to a JS type (number, Array, etc.)
docstring_summary: Converts a model.Type to a JS type (number, Array, etc.)
docstring_tokens: Converts a model . Type to a JS type ( number Array etc . )
function: def _TypeToJsType(self, namespace_name, js_type):
      """Converts a model.Type to a JS type (number, Array, etc.)"""
      if js_type.property_type in (PropertyType.INTEGER, PropertyType.DOUBLE):
        return Code().Append('number')
      if js_type.property_type is PropertyType.OBJECT:
        if js_type.properties:
          c = Code()
          self.AppendObjectDefinition(c, namespace_name, js_type.properties)
          return c
        return Code().Append('Object')
      if js_type.property_type is PropertyType.ARRAY:
        return (Code().Append('!Array<').
                Concat(self._TypeToJsType(namespace_name, js_type.item_type),
                       new_line=False).
             Append('>', new_line=False))
      if js_type.property_type is PropertyType.REF:
        ref_type = '!chrome.%s.%s' % (namespace_name, js_type.ref_type)
        return Code().Append(ref_type)
      if js_type.property_type is PropertyType.CHOICES:
        c = Code()
        c.Append('(')
        for i, choice in enumerate(js_type.choices):
          c.Concat(self._TypeToJsType(namespace_name, choice), new_line=False)
          if i is not len(js_type.choices) - 1:
            c.Append('|', new_line=False)
        c.Append(')', new_line=False)
        return c
      if js_type.property_type is PropertyType.FUNCTION:
        return self._FunctionToJsFunction(namespace_name, js_type.function)
      if js_type.property_type is PropertyType.BINARY:
        return Code().Append('ArrayBuffer')
      if js_type.property_type is PropertyType.ANY:
        return Code().Append('*')
      if js_type.property_type.is_fundamental:
        return Code().Append(js_type.property_type.name)
      return Code().Append('?')
function_tokens: def _TypeToJsType ( self , namespace_name , js_type ) : if js_type . property_type in ( PropertyType . INTEGER , PropertyType . DOUBLE ) : return Code ( ) . Append ( 'number' ) if js_type . property_type is PropertyType . OBJECT : if js_type . properties : c = Code ( ) self . AppendObjectDefinition ( c , namespace_name , js_type . properties ) return c return Code ( ) . Append ( 'Object' ) if js_type . property_type is PropertyType . ARRAY : return ( Code ( ) . Append ( '!Array<' ) . Concat ( self . _TypeToJsType ( namespace_name , js_type . item_type ) , new_line = False ) . Append ( '>' , new_line = False ) ) if js_type . property_type is PropertyType . REF : ref_type = '!chrome.%s.%s' % ( namespace_name , js_type . ref_type ) return Code ( ) . Append ( ref_type ) if js_type . property_type is PropertyType . CHOICES : c = Code ( ) c . Append ( '(' ) for i , choice in enumerate ( js_type . choices ) : c . Concat ( self . _TypeToJsType ( namespace_name , choice ) , new_line = False ) if i is not len ( js_type . choices ) - 1 : c . Append ( '|' , new_line = False ) c . Append ( ')' , new_line = False ) return c if js_type . property_type is PropertyType . FUNCTION : return self . _FunctionToJsFunction ( namespace_name , js_type . function ) if js_type . property_type is PropertyType . BINARY : return Code ( ) . Append ( 'ArrayBuffer' ) if js_type . property_type is PropertyType . ANY : return Code ( ) . Append ( '*' ) if js_type . property_type . is_fundamental : return Code ( ) . Append ( js_type . property_type . name ) return Code ( ) . Append ( '?' )