Skip to content
This repository was archived by the owner on Feb 1, 2022. It is now read-only.
This repository was archived by the owner on Feb 1, 2022. It is now read-only.

Including table flags in command, causes TypeScript not to compile #159

Description

@geoffreyvanwyk

My command's flags with the table flags at the end:

static flags = {
    bytes: flags.boolean({
      char: 'c',
      description: 'print the byte counts',
    }),

    chars: flags.boolean({
      char: 'm',
      description: 'print the character counts',
    }),

    'files-from': flags.string({
      description: 'read input from the file specified by NUL-terminated ' +
        'names in file "files-from"; if "files-from" is - then read names ' +
        'from standard input',
    }),

    file: flags.string({
      char: 'f',
      description: 'one or more files in which to count items',
      multiple: true,
      required: true,
    }),

    help: flags.help({char: 'h'}),

    lines: flags.boolean({
      char: 'l',
      description: 'print the newline counts',
    }),

    'max-line-length': flags.integer({
      char: 'L',
      description: 'print the maximum display width',
    }),

    version: flags.version({char: 'v'}),

    words: flags.boolean({
      char: 'w',
      description: 'print the word counts',
    }),

    ...cli.table.flags(),
  }

When I run the command, with or without table flags, I get this error:

/home/geoffrey/src/my/wordcounter/node_modules/ts-node/src/index.ts:293
return new TSError(diagnosticText, diagnosticCodes)
^
TSError: ⨯ Unable to compile TypeScript:
src/index.ts:5:7 - error TS2417: Class static side 'typeof SystemovichWordcounter' incorrectly extends base class static side 'typeof Command'.
Types of property 'flags' are incompatible.
Type '{ columns: IOptionFlag<string | undefined>; sort: IOptionFlag<string | undefined>; filter: IOptionFlag<string | undefined>; csv: IFlag; ... 12 more ...; words: IBooleanFlag<...>; }' is not assignable to type 'Input'.

I tried to combine the types to no avail.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions