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

Function addNewTypeMetadata

test/fixtures/snapshot/typescript.js:92660–92676  ·  view source on GitHub ↗
(node, container, decoratorExpressions)

Source from the content-addressed store, hash-verified

92658 }
92659 }
92660 function addNewTypeMetadata(node, container, decoratorExpressions) {
92661 if (compilerOptions.emitDecoratorMetadata) {
92662 var properties = void 0;
92663 if (shouldAddTypeMetadata(node)) {
92664 (properties || (properties = [])).push(factory.createPropertyAssignment("type", factory.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, factory.createToken(38 /* SyntaxKind.EqualsGreaterThanToken */), serializeTypeOfNode(node))));
92665 }
92666 if (shouldAddParamTypesMetadata(node)) {
92667 (properties || (properties = [])).push(factory.createPropertyAssignment("paramTypes", factory.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, factory.createToken(38 /* SyntaxKind.EqualsGreaterThanToken */), serializeParameterTypesOfNode(node, container))));
92668 }
92669 if (shouldAddReturnTypeMetadata(node)) {
92670 (properties || (properties = [])).push(factory.createPropertyAssignment("returnType", factory.createArrowFunction(/*modifiers*/ undefined, /*typeParameters*/ undefined, [], /*type*/ undefined, factory.createToken(38 /* SyntaxKind.EqualsGreaterThanToken */), serializeReturnTypeOfNode(node))));
92671 }
92672 if (properties) {
92673 decoratorExpressions.push(emitHelpers().createMetadataHelper("design:typeinfo", factory.createObjectLiteralExpression(properties, /*multiLine*/ true)));
92674 }
92675 }
92676 }
92677 /**
92678 * Determines whether to emit the "design:type" metadata based on the node's kind.
92679 * The caller should have already tested whether the node has decorators and whether the

Callers 1

addTypeMetadataFunction · 0.85

Calls 8

shouldAddTypeMetadataFunction · 0.85
serializeTypeOfNodeFunction · 0.85
emitHelpersFunction · 0.85
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…