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

Function serializeInterface

test/fixtures/snapshot/typescript.js:54582–54596  ·  view source on GitHub ↗
(symbol, symbolName, modifierFlags)

Source from the content-addressed store, hash-verified

54580 context.enclosingDeclaration = oldEnclosingDecl;
54581 }
54582 function serializeInterface(symbol, symbolName, modifierFlags) {
54583 var interfaceType = getDeclaredTypeOfClassOrInterface(symbol);
54584 var localParams = getLocalTypeParametersOfClassOrInterfaceOrTypeAlias(symbol);
54585 var typeParamDecls = ts.map(localParams, function (p) { return typeParameterToDeclaration(p, context); });
54586 var baseTypes = getBaseTypes(interfaceType);
54587 var baseType = ts.length(baseTypes) ? getIntersectionType(baseTypes) : undefined;
54588 var members = ts.flatMap(getPropertiesOfType(interfaceType), function (p) { return serializePropertySymbolForInterface(p, baseType); });
54589 var callSignatures = serializeSignatures(0 /* SignatureKind.Call */, interfaceType, baseType, 174 /* SyntaxKind.CallSignature */);
54590 var constructSignatures = serializeSignatures(1 /* SignatureKind.Construct */, interfaceType, baseType, 175 /* SyntaxKind.ConstructSignature */);
54591 var indexSignatures = serializeIndexSignatures(interfaceType, baseType);
54592 var heritageClauses = !ts.length(baseTypes) ? undefined : [ts.factory.createHeritageClause(94 /* SyntaxKind.ExtendsKeyword */, ts.mapDefined(baseTypes, function (b) { return trySerializeAsTypeReference(b, 111551 /* SymbolFlags.Value */); }))];
54593 addResult(ts.factory.createInterfaceDeclaration(
54594 /*decorators*/ undefined,
54595 /*modifiers*/ undefined, getInternalSymbolName(symbol, symbolName), typeParamDecls, heritageClauses, __spreadArray(__spreadArray(__spreadArray(__spreadArray([], indexSignatures, true), constructSignatures, true), callSignatures, true), members, true)), modifierFlags);
54596 }
54597 function getNamespaceMembersForSerialization(symbol) {
54598 return !symbol.exports ? [] : ts.filter(ts.arrayFrom(symbol.exports.values()), isNamespaceMember);
54599 }

Callers 1

serializeSymbolWorkerFunction · 0.85

Calls 15

getBaseTypesFunction · 0.85
getIntersectionTypeFunction · 0.85
getPropertiesOfTypeFunction · 0.85
serializeSignaturesFunction · 0.85
serializeIndexSignaturesFunction · 0.85
addResultFunction · 0.85
getInternalSymbolNameFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…