@Override public Void caseNamedType(NamedType type) { JSType refType = type.getReferencedType(); // When we dealing with partial inputs, we often end up with named type, without a // corresponding referencedType. Instead of emitting 'any', we emit literally the // name of the type as originally written. // It appears that when one writes '@type {A<B>}' and both are missing from the // compilation // unit - A ends up as NoType, while B ends up as NamedType. if (opts.partialInput && refType.isUnknownType()) { emitNoResolvedTypeAsumingForwardDeclare(type); return null; } // Handle "typeof expr" constructions, which translate directly to TypeScript. if (type.hasReferenceName() && type.getReferenceName().startsWith("typeof ")) { emit(type.getReferenceName()); return null; } visitType(refType); return null; }
private void handleUnresolvedType( ErrorReporter reporter, boolean ignoreForwardReferencedTypes) { boolean isForwardDeclared = ignoreForwardReferencedTypes && registry.isForwardDeclaredType(reference); if (!isForwardDeclared) { String msg = "Bad type annotation. Unknown type " + reference; warning(reporter, msg); } else { setReferencedType(new NoResolvedType(registry, getReferenceName(), getTemplateTypes())); if (validator != null) { validator.apply(getReferencedType()); } } setResolvedTypeInternal(getReferencedType()); }
if (this.isNamedType() && that.isNamedType()) { return Objects.equals( this.toMaybeNamedType().getReferenceName(), // that.toMaybeNamedType().getReferenceName()); } else { return true;