MCPcopy Index your code
hub / github.com/nodejs/node / reportCircularityError

Function reportCircularityError

test/fixtures/snapshot/typescript.js:56836–56851  ·  view source on GitHub ↗
(symbol)

Source from the content-addressed store, hash-verified

56834 return links.writeType || (links.writeType = instantiateType(getWriteTypeOfSymbol(links.target), links.mapper));
56835 }
56836 function reportCircularityError(symbol) {
56837 var declaration = symbol.valueDeclaration;
56838 // Check if variable has type annotation that circularly references the variable itself
56839 if (ts.getEffectiveTypeAnnotationNode(declaration)) {
56840 error(symbol.valueDeclaration, ts.Diagnostics._0_is_referenced_directly_or_indirectly_in_its_own_type_annotation, symbolToString(symbol));
56841 return errorType;
56842 }
56843 // Check if variable has initializer that circularly references the variable itself
56844 if (noImplicitAny && (declaration.kind !== 164 /* SyntaxKind.Parameter */ || declaration.initializer)) {
56845 error(symbol.valueDeclaration, ts.Diagnostics._0_implicitly_has_type_any_because_it_does_not_have_a_type_annotation_and_is_referenced_directly_or_indirectly_in_its_own_initializer, symbolToString(symbol));
56846 }
56847 // Circularities could also result from parameters in function expressions that end up
56848 // having themselves as contextual types following type argument inference. In those cases
56849 // we have already reported an implicit any error so we don't report anything here.
56850 return anyType;
56851 }
56852 function getTypeOfSymbolWithDeferredType(symbol) {
56853 var links = getSymbolLinks(symbol);
56854 if (!links.type) {

Calls 2

symbolToStringFunction · 0.85
errorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…