Class NoResolvedType
In most cases, it behaves like a sibling of the top object type.
Why have this class at all, and not just use the top object type or `*`?
Clutz relies on this class to emit .d.ts typings for JS files without having to see all their dependencies: Clutz expects unresolved types to be available when it runs, so that it can map them back to the corresponding goog.required import.
Clutz also sets a special JSCompiler flag so that all unresolved types are treated as forward declared. (In most non-Clutz cases, this class is only rarely used, and only if there's actually an explicit `goog.forwardDeclare` call.)
To address this, we would need to significantly refactor Clutz.
-
Nested Class Summary
Nested classes/interfaces inherited from class com.google.javascript.rhino.jstype.JSType
JSType.HasPropertyKind, JSType.Nullability, JSType.SubtypingMode, JSType.TypePair, JSType.WithSourceRef -
Field Summary
Fields inherited from class com.google.javascript.rhino.jstype.JSType
templateTypeMap -
Method Summary
Modifier and TypeMethodDescriptionbooleandefineProperty(Property.Key propertyName, JSType type, boolean inferred, Node propertyNode) @Nullable FunctionTypeGets this object's constructor.final @Nullable ObjectTypeGets the implicit prototype (a.k.a.Computes the set of possible outcomes of theToBooleanpredicate for this type.@Nullable StringGets the reference name for this object.@Nullable com.google.common.collect.ImmutableList<JSType> Gets the declared default element type.booleantestForEquality(JSType that) Comparesthisandthat.Methods inherited from class com.google.javascript.rhino.jstype.ObjectType
cast, clearCachedValues, createDelegateSuffix, defineDeclaredProperty, defineDeclaredProperty, defineInferredProperty, defineInferredProperty, defineSynthesizedProperty, findClosestDefinition, findClosestDefinition, findPropertyTypeWithoutConsideringTemplateTypes, getAllKeys, getClosestDefiningType, getCtorExtendedInterfaces, getCtorImplementedInterfaces, getDisplayName, getEnumeratedTypeOfEnumObject, getImplicitPrototypeChain, getJSDocInfo, getNormalizedReferenceName, getOwnerFunction, getOwnPropertyDefSite, getOwnPropertyDefSite, getOwnPropertyJSDocInfo, getOwnPropertyJSDocInfo, getOwnPropertyKeys, getOwnPropertyKind, getOwnPropertyKind, getOwnPropertyKnownSymbols, getOwnPropertyNames, getOwnSlot, getOwnSlot, getPropertiesCount, getPropertyDefSite, getPropertyDefSite, getPropertyJSDocInfo, getPropertyJSDocInfo, getPropertyKind, getPropertyNames, getPropertyNode, getPropertyNode, getPropertyType, getPropertyType, getPropertyTypeMap, getRawType, getSlot, getSlot, getSuperClassConstructor, getTypeOfThis, hasCachedValues, hasOwnDeclaredProperty, hasOwnDeclaredProperty, hasOwnProperty, hasOwnProperty, hasReferenceName, isFunctionPrototypeType, isNativeObjectType, isObject, isPropertyInExterns, isPropertyTypeDeclared, isPropertyTypeDeclared, isPropertyTypeInferred, isPropertyTypeInferred, isStructuralType, isUnknownType, setJSDocInfo, setPropertyJSDocInfo, setPropertyJSDocInfo, setPropertyNode, setPropertyNode, visitMethods inherited from class com.google.javascript.rhino.jstype.JSType
areSimilar, assertFunctionType, assertObjectType, autobox, autoboxesTo, canBeCalled, canCastTo, canTestForEqualityWith, canTestForShallowEqualityWith, collapseUnion, containsReferenceAncestor, dereference, differsFrom, equals, findPropertyType, findPropertyType, getEnumeratedTypeOfEnumElement, getGreatestSubtype, getLeastSupertype, getPropertyKind, getPropertyKind, getPropertyKind, getRestrictedTypeGivenOutcome, getTemplateParamCount, getTemplateTypeMap, getTypeParameters, getTypesUnderEquality, getTypesUnderInequality, getTypesUnderShallowEquality, getTypesUnderShallowInequality, getUnionMembers, hasAnyTemplateTypes, hasDisplayName, hashCode, hasProperty, hasProperty, isAllType, isArrayType, isBigIntObjectType, isBigIntOrNumber, isBigIntValueType, isBooleanObjectType, isBooleanValueType, isBoxableScalar, isCheckedUnknownType, isConstructor, isDateType, isDict, isEmptyType, isEnumElementType, isEnumType, isExplicitlyVoidable, isFunctionType, isGlobalThisType, isInstanceType, isInterface, isKnownSymbolValueType, isLiteralObject, isNamedType, isNominalConstructorOrInterface, isNominalType, isNoObjectType, isNoType, isNullable, isNullType, isNumber, isNumberObjectType, isNumberValueType, isObjectType, isOnlyBigInt, isOrdinaryFunction, isRawTypeOfTemplatizedType, isReadonlyArrayType, isRecordType, isRegexpType, isResolved, isSomeUnknownType, isString, isStringObjectType, isStringValueType, isStruct, isStructuralInterface, isSubtype, isSubtype, isSubtypeOf, isSubtypeOf, isSubtypeWithoutStructuralTyping, isSuccessfullyResolved, isSymbol, isSymbolObjectType, isSymbolValueType, isTemplateType, isTemplatizedType, isUnionType, isUnsuccessfullyResolved, isVoidable, isVoidType, loosenTypecheckingDueToForwardReferencedSupertype, matchConstraint, matchesNumberContext, matchesObjectContext, matchesStringContext, matchesSymbolContext, mergeSupertypeTemplateTypes, resolve, restrictByNotNull, restrictByNotNullOrUndefined, restrictByNotUndefined, setValidator, toAnnotationString, toMaybeEnumElementType, toMaybeEnumType, toMaybeFunctionType, toMaybeFunctionType, toMaybeKnownSymbolType, toMaybeNamedType, toMaybeObjectType, toMaybeRecordType, toMaybeTemplateType, toMaybeTemplatizedType, toMaybeUnionType, toObjectType, toString
-
Method Details
-
getReferenceName
Description copied from class:ObjectTypeGets the reference name for this object. This includes named types like constructors, prototypes, and enums. It notably does not include literal types like strings and booleans and structural types.Returning an empty string means something different than returning null. An empty string may indicate an anonymous constructor, which we treat differently than a literal type without a reference name. e.g. in
InstanceObjectType.appendTo(TypeStringBuilder)- Specified by:
getReferenceNamein classObjectType- Returns:
- the object's name or
nullif this is an anonymous object
-
getTemplateTypes
Description copied from class:ObjectTypeGets the declared default element type.- Overrides:
getTemplateTypesin classObjectType- See Also:
-
isNoResolvedType
public boolean isNoResolvedType()- Overrides:
isNoResolvedTypein classJSType
-
getPossibleToBooleanOutcomes
Description copied from class:JSTypeComputes the set of possible outcomes of theToBooleanpredicate for this type. TheToBooleanpredicate is defined by the ECMA-262 standard, 3rd edition. Its behavior for simple types can be summarized by the following table:ToBoolean results by input type type result undefined{false} null{false} boolean{true, false} number{true, false} string{true, false} Object{true} - Overrides:
getPossibleToBooleanOutcomesin classObjectType- Returns:
- the set of boolean literals for this type
-
testForEquality
Description copied from class:JSTypeComparesthisandthat.- Overrides:
testForEqualityin classObjectType- Returns:
Tri.TRUEif the comparison of values ofthistype andthatalways succeed (such asundefinedcompared tonull)Tri.FALSEif the comparison of values ofthistype andthatalways fails (such asundefinedcompared tonumber)Tri.UNKNOWNif the comparison can succeed or fail depending on the concrete values
-
getConstructor
Description copied from class:ObjectTypeGets this object's constructor.- Specified by:
getConstructorin classObjectType- Returns:
- this object's constructor or
nullif it is a native object (constructed natively v.s. by instantiation of a function)
-
getImplicitPrototype
Description copied from class:ObjectTypeGets the implicit prototype (a.k.a. the[[Prototype]]property).- Specified by:
getImplicitPrototypein classObjectType
-
defineProperty
public boolean defineProperty(Property.Key propertyName, JSType type, boolean inferred, Node propertyNode)
-