(value: BaseRoot)
| 162 | * value like `unknown` allowing undefined otherwise keeps it, as in TS |
| 163 | */ |
| 164 | export const withoutUndefined = (value: BaseRoot): BaseRoot => { |
| 165 | const branches = value.branches.filter(branch => !branch.hasUnit(undefined)) |
| 166 | if (branches.length === value.branches.length) return value |
| 167 | return value.$.node("union", { |
| 168 | branches, |
| 169 | ...(value.is("union") && value.ordered ? { ordered: true } : {}) |
| 170 | }) |
| 171 | } |
| 172 | |
| 173 | export const assertDefaultValueAssignability = ( |
| 174 | node: BaseRoot, |
no test coverage detected