protected _checkType()

in src/terminal.ts [100:117]


  protected _checkType<T>(name: string, value: T | undefined, type: string, allowArray: boolean = false): void {
    if (value === undefined) {
      return;
    }
    if (allowArray) {
      if (Array.isArray(value)) {
        value.forEach((v, i) => {
          if (typeof v !== type) {
            throw new Error(`${name}[${i}] must be a ${type} (not a ${typeof v[i]})`);
          }
        });
        return;
      }
    }
    if (typeof value !== type) {
      throw new Error(`${name} must be a ${type} (not a ${typeof value})`);
    }
  }