MCPcopy Create free account
hub / github.com/LambdaNote/support-ts-tapl / getProp

Function getProp

book/tiny-ts-parser.ts:542–550  ·  view source on GitHub ↗
(property: p.TSESTree.ObjectLiteralElement)

Source from the content-addressed store, hash-verified

540}
541
542function getProp(property: p.TSESTree.ObjectLiteralElement) {
543 if (property.type === "SpreadElement") error("spread operator is not allowed", property);
544 if (property.computed) error("key must be bare", property);
545 if (property.value.type === "AssignmentPattern") error("AssignmentPattern is not allowed", property);
546 if (property.value.type === "TSEmptyBodyFunctionExpression") {
547 error("TSEmptyBodyFunctionExpression is not allowed", property);
548 }
549 return { key: getIdentifier(property.key), value: property.value };
550}
551
552function getTagAndProps(node: p.TSESTree.ObjectExpression) {
553 const props = node.properties.map(getProp);

Callers 1

convertExprFunction · 0.70

Calls 2

errorFunction · 0.70
getIdentifierFunction · 0.70

Tested by

no test coverage detected