(property: p.TSESTree.ObjectLiteralElement)
| 193 | } |
| 194 | |
| 195 | function getProp(property: p.TSESTree.ObjectLiteralElement) { |
| 196 | if (property.type === "SpreadElement") error("spread operator is not allowed", property); |
| 197 | if (property.computed) error("key must be bare", property); |
| 198 | if (property.value.type === "AssignmentPattern") error("AssignmentPattern is not allowed", property); |
| 199 | if (property.value.type === "TSEmptyBodyFunctionExpression") { |
| 200 | error("TSEmptyBodyFunctionExpression is not allowed", property); |
| 201 | } |
| 202 | return { key: getIdentifier(property.key), value: property.value }; |
| 203 | } |
| 204 | |
| 205 | function getTagAndVal(node: p.TSESTree.ObjectExpression) { |
| 206 | if (node.properties.length !== 2) error(`tagged union must be <TYPE>{ tag: "TAG", val: EXPR }`, node); |
no test coverage detected