Skip to content

When there is a var_args param, treat arguments like an Array of that type #577

@MatrixFrog

Description

@MatrixFrog

While working on #152 I found a few places we're lacking type information because we don't know the type of the arguments object. For example at https://github.com/google/closure-library/blob/d0bd16969214db45c6719604e59bd46da8fce616/closure/goog/math/box.js#L76-77

it is obvious that coord is a goog.math.Coordinate from the type of the var_args parameter. But the compiler treats it as "unknown" because it doesn't know that arguments is an Array* of goog.math.Coordinate, so it doesn't know that arguments[i] is a goog.math.Coordinate.

  • I know, it's not really an Array, but it's sufficiently Array-ish that we should know the type of its elements.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions