* Returns true when a field's read cannot recurse and needs no depth tracking. * Covers leaf scalars, typed arrays, and collections/maps whose elements are all leaf types.
(typeInfo: TypeInfo)
| 36 | * Covers leaf scalars, typed arrays, and collections/maps whose elements are all leaf types. |
| 37 | */ |
| 38 | function isDepthFreeField(typeInfo: TypeInfo): boolean { |
| 39 | const id = typeInfo.typeId; |
| 40 | if (TypeId.isLeafTypeId(id)) return true; |
| 41 | // LIST / SET with leaf element type |
| 42 | if (id === TypeId.LIST || id === TypeId.SET) { |
| 43 | const inner = typeInfo.options?.inner; |
| 44 | return !!inner && TypeId.isLeafTypeId(inner.typeId); |
| 45 | } |
| 46 | // MAP with leaf key and value types |
| 47 | if (id === TypeId.MAP) { |
| 48 | const key = typeInfo.options?.key; |
| 49 | const value = typeInfo.options?.value; |
| 50 | return !!key && !!value && TypeId.isLeafTypeId(key.typeId) && TypeId.isLeafTypeId(value.typeId); |
| 51 | } |
| 52 | return false; |
| 53 | } |
| 54 | |
| 55 | function compatibleReadTargetExpr(typeInfo: TypeInfo, expr: string): string { |
| 56 | const action = getCompatibleCollectionArrayReadAction(typeInfo); |
no outgoing calls
no test coverage detected