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

Function widenTypeInferredFromInitializer

test/fixtures/snapshot/typescript.js:79562–79575  ·  view source on GitHub ↗
(declaration, type)

Source from the content-addressed store, hash-verified

79560 return createTupleType(elementTypes, elementFlags, type.target.readonly);
79561 }
79562 function widenTypeInferredFromInitializer(declaration, type) {
79563 var widened = ts.getCombinedNodeFlags(declaration) & 2 /* NodeFlags.Const */ || ts.isDeclarationReadonly(declaration) ? type : getWidenedLiteralType(type);
79564 if (ts.isInJSFile(declaration)) {
79565 if (isEmptyLiteralType(widened)) {
79566 reportImplicitAny(declaration, anyType);
79567 return anyType;
79568 }
79569 else if (isEmptyArrayLiteralType(widened)) {
79570 reportImplicitAny(declaration, anyArrayType);
79571 return anyArrayType;
79572 }
79573 }
79574 return widened;
79575 }
79576 function isLiteralOfContextualType(candidateType, contextualType) {
79577 if (contextualType) {
79578 if (contextualType.flags & 3145728 /* TypeFlags.UnionOrIntersection */) {

Calls 4

getWidenedLiteralTypeFunction · 0.85
isEmptyLiteralTypeFunction · 0.85
reportImplicitAnyFunction · 0.85
isEmptyArrayLiteralTypeFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…