Skip to main content
Module

x/create_react_app/deps.ts>cli.Type

Create React App with Deno
Latest
class cli.Type
Re-export
Abstract
import { cli } from "https://deno.land/x/create_react_app@v0.1.2/deps.ts";
const { Type } = cli;

Base class for custom types.

Custom type example:

export class ColorType extends Type<string> {
  public parse({ label, name, value, type }: ITypeInfo): string {
    if (["red", "blue"].includes(value)) {
      trow new Error(
        `${label} "${name}" must be of type "${type}", but got "${value}".` +
        "Valid colors are: red, blue"
      );
    }
    return value;
  }

  public complete(): string[] {
    return ["red", "blue"];
  }
}

Methods

optional
complete(cmd: Command<any, any, any, any, any>, parent?: Command<any, any, any, any, any>): string[]
abstract
parse(type: ITypeInfo): T