swc/bundler/tests/.cache/deno/91a3278cffe125ea1d39ab32b68668328582caa0.ts
강동윤 bbaf619f63
fix(bundler): Fix bugs (#1437)
swc_bundler:
 - [x] Fix wrapped esms. (denoland/deno#9307)
 - [x] Make test secure.
2021-03-02 17:33:03 +09:00

33 lines
662 B
TypeScript

// Loaded from https://deno.land/x/args@1.0.7/command-errors.ts
import {
ParseError,
} from "./types.ts";
import {
FlagError,
} from "./flag-errors.ts";
/**
* Class of error created by `CommandType::extract`
* @template ErrList Type of array of {@link FlagError}
*/
export class CommandError<
ErrList extends readonly FlagError[],
> implements ParseError, Iterable<FlagError> {
constructor(
/** Array of {@link FlagError} */
public readonly errors: ErrList,
) {}
public readonly toString = () =>
this.errors
.map((error) => error.toString())
.join("\n");
public *[Symbol.iterator]() {
yield* this.errors;
}
}