Package com.google.javascript.rhino

# Class JSTypeExpression

java.lang.Object
com.google.javascript.rhino.JSTypeExpression

All Implemented Interfaces:
  `Serializable`

public final class JSTypeExpression extends Object implements Serializable
Represents a type expression as a miniature Rhino AST, so that the type expression can be evaluated later.

See Also:
  - Serialized Form

## Constructor Summary

Constructors
Constructor
Description
`JSTypeExpression(Node root, String sourceName)`

## Method Summary

Modifier and Type
Method
Description
`boolean`
`equals(Object other)`
`JSType`
`evaluate(StaticScope<JSType> scope, JSTypeRegistry registry)`
Evaluates the type expression into a `JSType` object.
`Node`
`getRoot()`
`int`
`hashCode()`
`boolean`
`isOptionalArg()`
`boolean`
`isVarArgs()`
`static JSTypeExpression`
`makeOptionalArg(JSTypeExpression expr)`
Make the given type expression into an optional type expression, if possible.

### Methods inherited from class java.lang.Object

`clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### JSTypeExpression

public JSTypeExpression(Node root, String sourceName)

## Method Details

### makeOptionalArg

public static JSTypeExpression makeOptionalArg(JSTypeExpression expr)
Make the given type expression into an optional type expression, if possible.

### isOptionalArg

public boolean isOptionalArg()

Returns:
  Whether this expression denotes an optional `@param`.

### isVarArgs

public boolean isVarArgs()

Returns:
  Whether this expression denotes a rest args `@param`.

### evaluate

public JSType evaluate(StaticScope<JSType> scope, JSTypeRegistry registry)
Evaluates the type expression into a `JSType` object.

### equals

public boolean equals(Object other)

Overrides:
  `equals` in class `Object`

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`

### getRoot

public Node getRoot()

Returns:
  The source for this type expression. Note that it will not contain an expression if there's an @override tag.