(children: EncodedElement[])
| 21 | } |
| 22 | |
| 23 | function decodeChildren(children: EncodedElement[]): ReactElement<unknown>[] { |
| 24 | const elements: ReactElement<unknown>[] = []; |
| 25 | |
| 26 | children.forEach((current) => { |
| 27 | if (!current) { |
| 28 | return; |
| 29 | } |
| 30 | |
| 31 | switch (current.type) { |
| 32 | case "List": { |
| 33 | elements.push(decodeList(current)); |
| 34 | break; |
| 35 | } |
| 36 | case "RowComponent": { |
| 37 | elements.push(decodeRowComponent(current)); |
| 38 | break; |
| 39 | } |
| 40 | case "Text": { |
| 41 | elements.push(decodeText(current)); |
| 42 | break; |
| 43 | } |
| 44 | default: { |
| 45 | console.warn("Could not decode type:", current); |
| 46 | } |
| 47 | } |
| 48 | }); |
| 49 | |
| 50 | return elements; |
| 51 | } |
| 52 | |
| 53 | function decodeList( |
| 54 | json: EncodedListElement |
no test coverage detected