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

Function checkArrayLiteralAssignment

test/fixtures/snapshot/typescript.js:78719–78737  ·  view source on GitHub ↗
(node, sourceType, checkMode)

Source from the content-addressed store, hash-verified

78717 }
78718 }
78719 function checkArrayLiteralAssignment(node, sourceType, checkMode) {
78720 var elements = node.elements;
78721 if (languageVersion < 2 /* ScriptTarget.ES2015 */ && compilerOptions.downlevelIteration) {
78722 checkExternalEmitHelpers(node, 512 /* ExternalEmitHelpers.Read */);
78723 }
78724 // This elementType will be used if the specific property corresponding to this index is not
78725 // present (aka the tuple element property). This call also checks that the parentType is in
78726 // fact an iterable or array (depending on target language).
78727 var possiblyOutOfBoundsType = checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */ | 128 /* IterationUse.PossiblyOutOfBounds */, sourceType, undefinedType, node) || errorType;
78728 var inBoundsType = compilerOptions.noUncheckedIndexedAccess ? undefined : possiblyOutOfBoundsType;
78729 for (var i = 0; i < elements.length; i++) {
78730 var type = possiblyOutOfBoundsType;
78731 if (node.elements[i].kind === 225 /* SyntaxKind.SpreadElement */) {
78732 type = inBoundsType = inBoundsType !== null && inBoundsType !== void 0 ? inBoundsType : (checkIteratedTypeOrElementType(65 /* IterationUse.Destructuring */, sourceType, undefinedType, node) || errorType);
78733 }
78734 checkArrayLiteralDestructuringElementAssignment(node, sourceType, i, type, checkMode);
78735 }
78736 return sourceType;
78737 }
78738 function checkArrayLiteralDestructuringElementAssignment(node, sourceType, elementIndex, elementType, checkMode) {
78739 var elements = node.elements;
78740 var element = elements[elementIndex];

Callers 1

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…