JSType inferType ( ) { JSType inferredType = inferTypeWithoutUsingDefaultValue ( ) ; if ( ! inferredType . isUnknownType ( ) && hasDefaultValue ( ) ) { JSType defaultValueType = getDefaultValue ( ) . getJSType ( ) ; if ( defaultValueType == null ) { defaultValueType = registry . getNativeType ( JSTypeNative . UNKNOWN_TYPE ) ; } // We effectively replace '|undefined" with '|typeOfDefaultValue' return registry . createUnionType ( inferredType . restrictByNotUndefined ( ) , defaultValueType ) ; } else { return inferredType ; } }
Infers the type of this target