Consistent rules for mixing @type, @param, @return, @template
          #1979
        
          
      
      
        
          +335
        
        
          −140
        
        
          
        
      
    
  
  Add this suggestion to a batch that can be applied as a single commit.
  This suggestion is invalid because no changes were made to the code.
  Suggestions cannot be applied while the pull request is closed.
  Suggestions cannot be applied while viewing a subset of changes.
  Only one suggestion per line can be applied in a batch.
  Add this suggestion to a batch that can be applied as a single commit.
  Applying suggestions on deleted lines is not supported.
  You must change the existing code in this line in order to create a valid suggestion.
  Outdated suggestions cannot be applied.
  This suggestion has been applied or marked resolved.
  Suggestions cannot be applied from pending reviews.
  Suggestions cannot be applied on multi-line comments.
  Suggestions cannot be applied while the pull request is queued to merge.
  Suggestion cannot be applied right now. Please check back later.
  
    
  
    
This PR implements rules for mixing of
@type,@param,@return, and@templateJSDoc annotations and removes the restriction from #1468 that made it an error to mix@typewith any of the other annotations. The specific rules implemented by the PR are:@typeon a function is applicable when there are no preceding@param,@return, or@templateannotations and no@typeannotations on the function's parameters.@paramfor a parameter is applicable when there is no applicable@typeannotation for the function and no@typeannotation on the parameter.@returnis applicable when there is no applicable@typeannotation for the function.@templateis applicable when there is no applicable@typeannotation for the function.@typeon a parameter is always applicable.It isn't an error for an annotation to be inapplicable. Rather, the type specified in the annotation is simply ignored.
These rules aren't necessarily ideal (whatever that might be), but they are consistent and enforceable without excessively complicated logic.
Fixes #1970.