( base: mutableInnerOfKind<"sequence">, element: BaseRoot )
| 167 | } |
| 168 | |
| 169 | const appendVariadicElement = ( |
| 170 | base: mutableInnerOfKind<"sequence">, |
| 171 | element: BaseRoot |
| 172 | ): mutableInnerOfKind<"sequence"> => { |
| 173 | // e.g. [...string[], number, ...string[]] |
| 174 | if (base.postfix) throwParseError(multipleVariadicMesage) |
| 175 | if (base.variadic) { |
| 176 | if (!base.variadic.equals(element)) { |
| 177 | // e.g. [...string[], ...number[]] |
| 178 | throwParseError(multipleVariadicMesage) |
| 179 | } |
| 180 | // e.g. [...string[], ...string[]] |
| 181 | // do nothing, second spread doesn't change the type |
| 182 | } else { |
| 183 | // e.g. [string, ...number[]] |
| 184 | base.variadic = element.internal |
| 185 | } |
| 186 | return base |
| 187 | } |
| 188 | |
| 189 | const appendSpreadBranch = ( |
| 190 | base: mutableInnerOfKind<"sequence">, |
no test coverage detected