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

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

Open
geoffreyvanwyk opened this issue Jun 13, 2020 · 1 comment
Open

Comments

@geoffreyvanwyk
Copy link

geoffreyvanwyk commented Jun 13, 2020

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.

@RasPhilCo
Copy link
Contributor

Try updating your oclif dependencies and/or typescript to v3.8.3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants