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

Function getUnmatchedAttributes

test/fixtures/snapshot/typescript.js:155119–155143  ·  view source on GitHub ↗
(checker, target, source)

Source from the content-addressed store, hash-verified

155117 ((ts.getObjectFlags(type) & 128 /* ObjectFlags.ObjectLiteral */) || (type.symbol && ts.tryCast(ts.singleOrUndefined(type.symbol.declarations), ts.isTypeLiteralNode)));
155118 }
155119 function getUnmatchedAttributes(checker, target, source) {
155120 var attrsType = checker.getContextualType(source.attributes);
155121 if (attrsType === undefined)
155122 return ts.emptyArray;
155123 var targetProps = attrsType.getProperties();
155124 if (!ts.length(targetProps))
155125 return ts.emptyArray;
155126 var seenNames = new ts.Set();
155127 for (var _i = 0, _a = source.attributes.properties; _i < _a.length; _i++) {
155128 var sourceProp = _a[_i];
155129 if (ts.isJsxAttribute(sourceProp)) {
155130 seenNames.add(sourceProp.name.escapedText);
155131 }
155132 if (ts.isJsxSpreadAttribute(sourceProp)) {
155133 var type = checker.getTypeAtLocation(sourceProp.expression);
155134 for (var _b = 0, _c = type.getProperties(); _b < _c.length; _b++) {
155135 var prop = _c[_b];
155136 seenNames.add(prop.escapedName);
155137 }
155138 }
155139 }
155140 return ts.filter(targetProps, function (targetProp) {
155141 return ts.isIdentifierText(targetProp.name, target, 1 /* LanguageVariant.JSX */) && !((targetProp.flags & 16777216 /* SymbolFlags.Optional */ || ts.getCheckFlags(targetProp) & 48 /* CheckFlags.Partial */) || seenNames.has(targetProp.escapedName));
155142 });
155143 }
155144 function tryGetContainingMethodDeclaration(node, callExpression) {
155145 if (ts.isTypeLiteralNode(node)) {
155146 return undefined;

Callers 1

getInfoFunction · 0.85

Calls 5

getPropertiesMethod · 0.80
addMethod · 0.65
filterMethod · 0.65
hasMethod · 0.65
lengthMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…